Skip to content

Instantly share code, notes, and snippets.

@etki
Created February 5, 2016 16:54
Show Gist options
  • Save etki/d4aa2dbd4b510840d1f4 to your computer and use it in GitHub Desktop.
Save etki/d4aa2dbd4b510840d1f4 to your computer and use it in GitHub Desktop.
D:
CompletableFuture<Map<UUID, Collection<SuperCow>> method() {
CompletableFuture<Collection<SuperCow>> starter = callProvider();
return starter
.thenApply(c -> c.stream().collect(Collectors.groupingBy(SuperCow::getGroupingId))) // Map<UUID, List<SuperCow>>
.thenApply(m -> m.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); // FFUUUUUUUUUU
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment