Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save mcupak/86e52f089470beb85ad6a03c9939e4de to your computer and use it in GitHub Desktop.

Select an option

Save mcupak/86e52f089470beb85ad6a03c9939e4de to your computer and use it in GitHub Desktop.
jshell> entries.collect(Collectors.groupingBy(e -> e.getKey(), Collectors.flatMapping(e -> e.getValue().stream(), Collectors.toSet())))
$2 ==> {1=[a, b, c], 2=[d]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment