DevoxxUK Lambdas Lab

Henry Jen henry.jen at
Wed Apr 3 16:08:50 PDT 2013

On 04/03/2013 04:04 AM, Maurizio Cimadamore wrote:
> Hi Stephen,
> these problems are known, and are caused by the fact that the structural 
> most specific check only kicks in when the two candidates' SAM have 
> descriptors with the _same_ argument types. Unfortunately the signature 
> of those methods:
> <T> comparing(ToLongFunction<? super T>)
> <T>comparing(ToDoubleFunction<? super T>)
> do not satisfy this property, as the argument types of the two 
> descriptor are _two_ different type-variables.
> We are looking into ways to overcome this limitation.

As Maurizio mentioned, this problem is known, and currently in lambda
repo, similar default methods in Comparator are having same problems as
we change the type to be wildcard.

In case we don't have a solution in time for JDK8 to overcome this, the
backup plan is to rename those functions to disambiguate, something like,

comparing(Function<? super T, ? extends U>)
comparingInt(ToIntFunction<? super T>


More information about the lambda-dev mailing list