8048989: small errors in Collectors examples
Reviewed-by: darcy
Contributed-by: raoul@urma.com
--- 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