changeset 10242:98c78397549d

8048989: small errors in Collectors examples Reviewed-by: darcy Contributed-by: raoul@urma.com
author smarks
date Tue, 01 Jul 2014 23:39:31 -0700
parents 075293ea610b
children 4623ea09772f
files src/share/classes/java/util/stream/Collectors.java
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/stream/Collectors.java	Tue Jul 01 21:23:54 2014 +0200
+++ b/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