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

Brian Goetz brian.goetz at oracle.com
Mon Nov 26 11:10:10 PST 2012


However, this is the first time I'm noticing that you're using the name compose() not only for function composition, but also for forming a compound comparator. Has it been suggested that we not reuse the compose() name to mean this other thing? Note that there does exist a compose operation for Comparators, but it's (Function, Comparator) -> Comparator (Guava puts it in the other order and calls it "onResultOf", which I'm not recommending).

It has not been suggested until now. I am fine calling this something that does not contain the string "compose". The key concept is "I have two comparators, and I want to build a dictionary-order comparator for (O1, O2)."

I am fine with .compose() for functions.

I think .compose(other) is too cryptic for comparators. I think .composeWith() is better; I can imagine there are other things that are also better. Now taking suggestions. (Though onResultOf does not seem better.)



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