RFR(XS): JDK-8048989 small errors in Collectors examples (original) (raw)

Joe Darcy joe.darcy at oracle.com
Wed Jul 2 00:41:58 UTC 2014


Looks fine Stuart,

-Joe

On 07/01/2014 05:34 PM, Stuart Marks wrote:

Please review this small patch to fix some errors in the examples in the docs for java.util.stream.Collectors. Thanks to Raoul Urma for pointing these out.

s'marks # HG changeset patch # User smarks # Date 1404256293 25200 # Tue Jul 01 16:11:33 2014 -0700 # Node ID 5b6a12d8a26e96052bc1c3ff787e8836fa4d64da # Parent 71012e1b8534c481ba42a38e77fca0b90299628d 8048989: small errors in Collectors examples Reviewed-by: XXX Contributed-by: raoul at urma.com diff -r 71012e1b8534 -r 5b6a12d8a26e src/share/classes/java/util/stream/Collectors.java --- a/src/share/classes/java/util/stream/Collectors.java Mon Jun 16 17:52:21 2014 -0700 +++ b/src/share/classes/java/util/stream/Collectors.java Tue Jul 01 16:11:33 2014 -0700 @@ -729,7 +729,7 @@ * person in each city: *

{@code
* Comparator byHeight = Comparator.comparing(Person::getHeight); - * Map tallestByCity + * Map> tallestByCity * = people.stream().collect(groupingBy(Person::getCity, reducing(BinaryOperator.maxBy(byHeight)))); * } * @@ -784,7 +784,7 @@ * Comparator 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)))); * } * * @param the type of the input elements



More information about the core-libs-dev mailing list