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

Remi Forax forax at univ-mlv.fr
Mon Nov 26 15:38:31 PST 2012


On 11/26/2012 11:57 PM, Brian Goetz wrote:

I like the "then" convention to indicate sequencing. In context:

people.sort(comparing(Person::getLast) .thenCompare(comparing(Person::getFirst))) or people.sort(comparing(Person::getLast, Person::getFirst)) (comparing is a static method so it can be annotated with @SafeVarargs). This one falls apart as there is no common supertype between Function<Person, T extends Comparable<? super T>> and IntFunction

You said in a previous mail that Function and IntFunction should not have the same function name (apply, applyAsInt) but IntFunction is not a subtype of Function. What is the rational about this decision ?

so people will try people.sort(comparing(Person::getLast, Person::getHeight)) and be mystified by the error message they get. And then ask for a combinatorial explosion of comparing() methods.

Rémi



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