8043327: Collectors.toMap studentToGPA example uses Functions.identity()
authorpsandoz
Thu, 03 Jul 2014 09:30:25 +0200
changeset 25224 7c7e029826e1
parent 25223 4d33af5975a5
child 25225 f161e8748e8d
8043327: Collectors.toMap studentToGPA example uses Functions.identity() 8043328: Typo in documentation of package java.util.stream Reviewed-by: alanb, lancea
jdk/src/share/classes/java/util/stream/Collectors.java
jdk/src/share/classes/java/util/stream/package-info.java
--- 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