We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7b9980c commit 4219619Copy full SHA for 4219619
1 file changed
src/FDynamic/Stream/CollectorsDemo.java
@@ -16,6 +16,7 @@ public static void main(String[] args) {
16
new Person("bbb", 19, new BigDecimal(124))
17
);
18
groupBy(personList);
19
+ partionBy(personList);
20
}
21
22
/**
@@ -28,4 +29,14 @@ public static void groupBy(List<Person> personList){
28
29
System.out.println(map);
30
31
32
+ /**
33
+ * 根据人员的name是否是aaa来进行区分
34
+ * @param personList
35
+ */
36
+ public static void partionBy(List<Person> personList){
37
+ Map<Boolean, List<Person>> map=personList.stream()
38
+ .collect(Collectors.partitioningBy(person -> "aaa".equals(person.getName())));
39
+ System.out.println(map);
40
+ }
41
+
42
0 commit comments