February 2014
Beginner
1248 pages
62h 25m
English
Lines 19–20 call Stream method collect to summarize the results into a Map<Integer, Long>. The first argument to Collectors method groupingBy (line 19) calls static method identity from interface Function, which creates a Function that simply returns its argument. This allows the actual random values to be used as the Map’s keys. The second argument to method groupingBy counts the number of occurrences of each key.
Read now
Unlock full access