@SafeVarargs
  public static CompletableFuture<Void> allOf(Collection<? extends CompletionStage<?>>... futureCollections) {
    List<CompletableFuture<Void>> fvs = new ArrayList<>();
    for (Collection<? extends CompletionStage<?>> futureCollection : futureCollections) {
      if (!futureCollection.isEmpty()) {
        fvs.add(CompletableFuture.allOf(futureCollection.toArray(new CompletableFuture[0])));
      }
    }

    return CompletableFuture.allOf(fvs.toArray(new CompletableFuture[0]));
  }
Returns a future that completes when all the futures in the provided collections of futures are complete.
@param futureCollections collections of futures to complete before the returned future is complete
samza-core/src/main/java/org/apache/samza/util/FutureUtil.java