Class Collectors

java.lang.Object
java.util.stream.Collectors

public final class Collectors extends Object

The common Collectors: into collections, maps, strings, groups and numbers.

The results are the JDK's: groupingBy answers a HashMap of ArrayLists unless told otherwise, toMap refuses a second value for a key unless given a function to merge them, and the unmodifiable variants refuse null.

Every function here is a class of its own, made only by the method that needs it, so an application carries the collectors it uses and no others.