What is the purpose of `Collectors.teeing()` introduced in Java 12?

Java Professional Medium

Java Professional — Medium

What is the purpose of `Collectors.teeing()` introduced in Java 12?

Key points

  • `Collectors.teeing()` merges results of two collectors
  • BiFunction is used to combine the results
  • Parallel execution of collectors is supported
  • Useful for scenarios requiring multiple independent calculations

Ready to go further?

Related questions