Skip to content

Instantly share code, notes, and snippets.

@kornysietsma
Created March 9, 2017 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kornysietsma/51feb6dbafcb4abf872e9f05fbb5cfde to your computer and use it in GitHub Desktop.
Save kornysietsma/51feb6dbafcb4abf872e9f05fbb5cfde to your computer and use it in GitHub Desktop.
Java 8 snippets
// turn a stream into a group
Map<String, Long> counting = items.stream().collect(
Collectors.groupingBy(Item::getName, Collectors.counting()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment