Jan 10 in JAVA
Q: Teeing Collectors JAVA12 Feature

1 Answer

Jan 10

Teeing Collector is the new collector utility introduced in the Streams API.

This collector has three arguments – Two collectors and a Bi-function.

All input values are passed to each collector and the result is available in the Bi-function.

double mean = Stream.of(1, 2, 3, 4, 5)


                        summingDouble(i -> i),


                        (sum, n) -> sum / n));


The output is 3.0.

Click here to read more about JAVA
Click here to read more about Insurance

Related questions

May 31 in JAVA
Oct 26 in Git
Aug 24 in MongoDB