public static <T> CompletableFuture<List<T>> allOf(List<CompletableFuture<T>> futures) {
    return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]))
      .thenApply(v -> futures.stream().map(f -> f.getNow(null)).collect(toList()));
  }
Returns a new CompletableFuture that is completed when all of the given CompletableFutures
complete. If any of the given CompletableFutures complete exceptionally, then the returned
CompletableFuture also does so, with a CompletionException holding this exception as its cause.
Otherwise, the results of all given CompletableFutures could be obtained by the new returned
CompletableFuture.
hbase-common/src/main/java/org/apache/hadoop/hbase/util/FutureUtils.java