Skip to content

Instantly share code, notes, and snippets.

@hakanilter
Created February 17, 2017 12:29
Show Gist options
  • Save hakanilter/7c565ab5f65b3b463f7964d403cf8b50 to your computer and use it in GitHub Desktop.
Save hakanilter/7c565ab5f65b3b463f7964d403cf8b50 to your computer and use it in GitHub Desktop.
Java 8 Parallel
Stream<Supplier<String>> calls = list.stream().map(value -> () -> callMe(value));
List<String> results = calls
.map(CompletableFuture::supplyAsync).collect(Collectors.toList())
.stream()
.map(CompletableFuture::join).collect(Collectors.toList());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment