8048989: small errors in Collectors examples
authorsmarks
Tue, 01 Jul 2014 23:39:31 -0700
changeset 25218 4d6cbcbcc437
parent 25217 2d687ea8608a
child 25219 d1a887dc2a2c
8048989: small errors in Collectors examples Reviewed-by: darcy Contributed-by: raoul@urma.com
jdk/src/share/classes/java/util/stream/Collectors.java
--- a/jdk/src/share/classes/java/util/stream/Collectors.java	Tue Jul 01 21:23:54 2014 +0200
+++ b/jdk/src/share/classes/java/util/stream/Collectors.java	Tue Jul 01 23:39:31 2014 -0700
@@ -729,7 +729,7 @@
      * person in each city:
      * <pre>{@code
      *     Comparator<Person> byHeight = Comparator.comparing(Person::getHeight);
-     *     Map<City, Person> tallestByCity
+     *     Map<City, Optional<Person>> tallestByCity
      *         = people.stream().collect(groupingBy(Person::getCity, reducing(BinaryOperator.maxBy(byHeight))));
      * }</pre>
      *
@@ -784,7 +784,7 @@
      *     Comparator<String> byLength = Comparator.comparing(String::length);
      *     Map<City, String> longestLastNameByCity
      *         = people.stream().collect(groupingBy(Person::getCity,
-     *                                              reducing(Person::getLastName, BinaryOperator.maxBy(byLength))));
+     *                                              reducing("", Person::getLastName, BinaryOperator.maxBy(byLength))));
      * }</pre>
      *
      * @param <T> the type of the input elements