We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d3fe44c commit afd3d42Copy full SHA for afd3d42
5-Streams API(II).md
@@ -132,7 +132,7 @@ HashSet<String> hashSet = stream.collect(Collectors.toCollection(HashSet::new));
132
```Java
133
// 使用toMap()统计学生GPA
134
Map<Student, Double> studentToGPA =
135
- students.stream().collect(Collectors.toMap(Functions.identity(),// 如何生成key
+ students.stream().collect(Collectors.toMap(Function.identity(),// 如何生成key
136
student -> computeGPA(student)));// 如何生成value
137
```
138
情况2:使用`partitioningBy()`生成的收集器,这种情况适用于将`Stream`中的元素依据某个二值逻辑(满足条件,或不满足)分成互补相交的两部分,比如男女性别、成绩及格与否等。下列代码展示将学生分成成绩及格或不及格的两部分。
0 commit comments