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().
The post Java streams 39. Collect 15. Collectors.filtering() collector appeared first on Nick Samoylov, programmer and writer.
Published on August 15, 2020 20:23