Comparator combinators

Brian Goetz brian.goetz at oracle.com
Thu Aug 15 18:04:26 PDT 2013


> comparing((IntFunction<T>) x -> x.size()) is not too bad IMHO.

or

    comparing((Foo x) -> x.size())

Its not completely intuitive that adding the argument type helps the 
compiler determine the best return type, but it does, because it enables 
the lambda to be type-checked bottom up (since it contains no inference 
variables anymore.)


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