8043327: Collectors.toMap studentToGPA example uses Functions.identity()
8043328: Typo in documentation of package java.util.stream
Reviewed-by: alanb, lancea
--- a/jdk/src/share/classes/java/util/stream/Collectors.java Wed Jul 02 14:14:17 2014 -0700
+++ b/jdk/src/share/classes/java/util/stream/Collectors.java Thu Jul 03 09:30:25 2014 +0200
@@ -1220,7 +1220,7 @@
* students to their grade point average:
* <pre>{@code
* Map<Student, Double> studentToGPA
- * students.stream().collect(toMap(Functions.identity(),
+ * students.stream().collect(toMap(Function.identity(),
* student -> computeGPA(student)));
* }</pre>
* And the following produces a {@code Map} mapping a unique identifier to
@@ -1228,7 +1228,7 @@
* <pre>{@code
* Map<String, Student> studentIdToStudent
* students.stream().collect(toMap(Student::getId,
- * Functions.identity());
+ * Function.identity());
* }</pre>
*
* @implNote
@@ -1390,7 +1390,7 @@
* students to their grade point average:
* <pre>{@code
* Map<Student, Double> studentToGPA
- * students.stream().collect(toMap(Functions.identity(),
+ * students.stream().collect(toMap(Function.identity(),
* student -> computeGPA(student)));
* }</pre>
* And the following produces a {@code Map} mapping a unique identifier to
@@ -1398,7 +1398,7 @@
* <pre>{@code
* Map<String, Student> studentIdToStudent
* students.stream().collect(toConcurrentMap(Student::getId,
- * Functions.identity());
+ * Function.identity());
* }</pre>
*
* <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
--- a/jdk/src/share/classes/java/util/stream/package-info.java Wed Jul 02 14:14:17 2014 -0700
+++ b/jdk/src/share/classes/java/util/stream/package-info.java Thu Jul 03 09:30:25 2014 +0200
@@ -468,7 +468,7 @@
* <pre>{@code
* int sumOfWeights = widgets.stream()
* .reduce(0,
- * (sum, b) -> sum + b.getWeight())
+ * (sum, b) -> sum + b.getWeight(),
* Integer::sum);
* }</pre>
* though the explicit map-reduce form is more readable and therefore should