Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. public Map<Artist, Long> filter(){
  2. Map<Artist, List<Concert>> raport = concerts.findAll().stream()
  3. .collect(Collectors.groupingBy(Concert::getArtist));
  4. Map<Artist, Long> raportt = raport.entrySet().stream()
  5. .map(a -> new AbstractMap.SimpleEntry<Artist, Long>(a.getKey(), a.getValue().stream().count()))
  6. .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
  7. return raportt;
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement