daily pastebin goal
12%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public final class CompletableFutures {
  2.  
  3.     public static <T> CompletableFuture<List<T>> sequence(List<CompletableFuture<T>> futures) {
  4.         CompletableFuture<Void> allDone = CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()]));
  5.         return allDone.thenApply(v -> futures.stream().map(future -> future.join()).collect(toList()));
  6.     }
  7.  
  8. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top