Bikeshed opportunity: compose vs composeWith

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<T> thenComparing(IntFunction<T> f) {
>      return thenComparing(comparing(f));
>    }
> 

That would make my example read like this.

TreeSet<Person> 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