The Collectors.teeing() collects stream elements twice concurrently, produces two results, and then uses the specified function to merge them into one final object.
Articles related to : Java programming
Java streams 41. Collect 17. Collectors.collectingAndThen() collector
The Collectors.collectingAndThen() allows collect the stream elements and add another (finishing) transformation to the result. It is especially useful for creating multi-level groups using Collectors.groupingBy() or Collectors.partitioningBy().
Java streams 40. Collect 16. Collectors.toUnmodifiableList/Set/Map() collectors
The Collectors.toUnmodifiableList/Set/Map() collectors create corresponding unmodifiable (elements cannot be added o removed) structure. That is why such a collector especially useful for creating multi-level groups using Collectors.groupingBy() or Collectors.partitioningBy().
Java streams 39. Collect 15. Collectors.filtering() collector
The Collectors.filtering() collector does two things at the same time: selects (filters) some of stream element and collects the results into one structure. That is why such a collector especially useful for creating multi-level groups using Collectors.groupingBy() or Collectors.partitioningBy().
Java streams 38. Collect 14. Collectors.reducing() collector
The Collectors.reducing() collector does two things at the same time: transforms each stream element and collects the results into one structure. That is why such a collector especially useful for creating multi-level groups using Collectors.groupingBy() or Collectors.partitioningBy().
Java streams 37. Collect 13. Collectors.flatMapping() collector
The Collectors.flatMapping() collector does two things at the same time: transforms each element into a stream of values and assembles the result. That is why such a collector especially useful as a parameter when a collector is created by Collectors.groupingBy() or Collectors.partitioningBy().
Java streams 36. Collect 12. Collectors.mapping() collector
The Collectors.mapping() collector does two things at the same time: transforms each element and assembles the results. That is why such a collector especially useful as a parameter when a collector is created by Collectors.groupingBy() or Collectors.partitioningBy().
Java streams 35. Collect 11. Collectors.partitioningBy() collector
The Collectors.partitioningBy() collector breaks the stream elements in two groups – one contains elements that fit the specified criteria and another one that contains elements that do not fit the specified criteria.
Java streams 34. Collect 10. Collectors.groupingByConcurrent() collector
Creating a Map object from Stream elements using Collectors.groupingByConcurrent() yields better performance (than .groupingBy())) while processing a parallel stream.
Java streams 32. Collect 8. Collectors.toConcurrentMap() collector
Creating a Map object from Stream elements using Collectors.toConcurrentMap() yields better (than .toMap()) performance while processing a parallel stream.