changeset 10248:8c061305cf30

8043327: Collectors.toMap studentToGPA example uses Functions.identity() 8043328: Typo in documentation of package java.util.stream Reviewed-by: alanb, lancea
author psandoz
date Thu, 03 Jul 2014 09:30:25 +0200
parents 48f37afb002c
children 5bd902923ccc
files src/share/classes/java/util/stream/Collectors.java src/share/classes/java/util/stream/package-info.java
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/stream/Collectors.java	Wed Jul 02 14:14:17 2014 -0700
+++ b/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/src/share/classes/java/util/stream/package-info.java	Wed Jul 02 14:14:17 2014 -0700
+++ b/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