Java Reference
In-Depth Information
Figure 6.6. Combining the effect of multiple collectors by nesting one
inside the other
The collectors are represented by the dashed lines, so
groupingBy
is the outermost one and groups
the menu stream into three substreams according to the different dishes' types.
The
groupingBy
collector wraps the
collectingAndThen
collector, so each substream resulting
from the grouping operation is further reduced by this second collector.
The
collectingAndThen
collector wraps in turn a third collector, the
maxBy
one.
Search WWH ::
Custom Search