Java 12 – Teeing Collector

What is a Teeing Collector? 

Teeing is a static method which allows you to collect through the use of two independent collectors, then merge their result using supplied BiFunction. 

Example 

A simple example showing the smallest whale (min) and largest whale (max) values of a list, in tons.

Code Example can be found here.

Setup

Method

Output 

Final Thoughts 

This method should be seen as a helper function which reduces verbosity. Increases code readibilty.

3 thoughts on “Java 12 – Teeing Collector

Leave a Reply

Your email address will not be published. Required fields are marked *