Request for Review: CR#8001667: Comparators class and Comparator extension method (original) (raw)

Henry Jen henry.jen at oracle.com
Wed Nov 14 04:09:23 UTC 2012


Hi,

This is a change set regarding Comparator already in lambda repo, it depends on the CR#8001634, particularly the Function SAMs.

It implements proposed extension methods on Comparator (reverse and compose) as well as static combinator methods in Comparators for things like turning a T -> {Comparable,int,long,double} into a Comparator.

This allows things like:

people.sort(Comparators.comparing(Person::getName)) Comparator byLastFirst = Comparators.comparing(Person::getLastName) .compose(Comparators.comparing(Person::getFirstName))

Please review and comment on the webrev[1].

[1] http://cr.openjdk.java.net/~henryjen/webrevs/8001667.0/

Cheers, Henry



More information about the core-libs-dev mailing list