Skip to content

Instantly share code, notes, and snippets.

@dmengelt
Created September 4, 2018 13:52
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 dmengelt/5efd25b9f52ea961ab025affe8b56127 to your computer and use it in GitHub Desktop.
Save dmengelt/5efd25b9f52ea961ab025affe8b56127 to your computer and use it in GitHub Desktop.
public Map<String, Integer> speciesCount2() {
return animalRepository.findAll()
.stream().collect(groupingBy(Animal::getSpecies, summingInt(x -> 1)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment