September 2019
Intermediate to advanced
816 pages
18h 47m
English
Starting with JDK 12, we can merge the results of two collectors via Collectors.teeing():

The result is a Collector that is a composite of two passed downstream collectors. Every element that's passed to the resulting collector is processed by both downstream collectors, and then their results are merged into the final result using the specified BiFunction.
Let's take a look at a classical problem. The following class simply stores the number of ...