Bikeshed opportunity: compose vs composeWith (original) (raw)

Raab, Donald Donald.Raab at gs.com
Thu Nov 29 08:12:45 PST 2012


I'm OK with thenComparing taking comparator and having convenience methods to take a Function too:

default Comparator thenComparing(IntFunction f) { return thenComparing(comparing(f)); }

That would make my example read like this.

TreeSet peopleByLastNameFirstNameAndAgeDesc = new TreeSet(comparing(Person::getLast).thenComparing(Person::getFirst).thenComparing(comparing(Person::getAge).reverse()));

It feels like comparing is a bit overloaded to me.



More information about the lambda-libs-spec-observers mailing list