What is the purpose of `Collectors.groupingBy()`?

  1. To filter elements in a stream
  2. To sort stream elements
  3. To group elements by a classifier function
  4. To merge multiple streams
Correct answer To group elements by a classifier function

Explanation

`groupingBy()` groups elements by the result of a classifier function into a Map.

By Ram Sharma · · 27 views