Functional Programming in Java, Second Edition: p. 57, GIve the names of the functions to collect

On Page 57, we read:

The collect() method takes a stream of elements and collects or gathers them into a result container. To do that, the method needs to know three things:

  • How to make a result container (for example, using the ArrayList::new method)
  • How to add a single element to a result container (for example, using the ArrayList::add method)
  • How to merge one result container into another (for example, using the ArrayList::addAll method)

According to the JavaDoc for Stream.collect/3

these are called “supplier”, “accumulator” and “combiner” .

Thus maybe:

The collect() method takes a stream of elements and collects or gathers them into a result container. To do that, the method needs to know three things:

  • The supplier: a function to allocate a result container (for example, using the ArrayList::new method)
  • The accumulator: a function to add a single element to a result container (for example, using the ArrayList::add method)
  • The combiner: a function to merge one result container into another (for example, using the ArrayList::addAll method)