Can i partition a stream combining with the grouping by functionality?
问题 I am grouping and partioning a stream as follows: // Partioning Map<Boolean, List<Person>> partitioned = persons.stream(). collect(Collectors.partitioningBy(p -> p.getAge() > 20)); // Grouping Map<String, List<Person>> grouped = persons.stream() .collect(Collectors.groupingBy(p -> p.getCity())); Is there a way i can combine both of these? I tried combining both with using groupingBy inside partioningBy, but did not get the things right. Any suggestion? The expected result is the partition the