Skip to main content
PreparationZone Logo
PreparationZone
Back to Java

Java · Hard · Pro

Collectors.teeing — aggregating two collectors at once?

JavaJava 8+Senior
Model answerPreview

Collectors.teeing

Collectors.teeing runs two collectors on the same stream elements and merges results with a bi-function—one pass, two aggregations.

  • Example: min and max in one collect.