Lambdas and serialization
Llewellyn Falco
isidore at setgame.com
Wed Nov 10 05:16:27 PST 2010
I just realized this is a mistake!
Comparable will not work properly without the Equals method
being overridden.
Namely, if you have two object a, b you will get
a.compareTo(b) == 0
but
a.equals(b) == false
depending on your implementation this will fail!
Llewellyn Falco
http:\\bit.ly\lambdas
On Wed, Oct 27, 2010 at 4:00 AM, Maurizio Cimadamore <
maurizio.cimadamore at oracle.com> wrote:
>
> btw: what happens with comparator? it's not a SAM (2 methods - compare,
>> equals), but seems to be a very wanted case for lambdas?
>>
>>
>>
> The definition of SAM does not take into account methods inherithed from
> java.lang.Object. Which means that Comparator<T> really has just one
> relevant target method and therefore can be used as the target of a SAM
> conversion.
>
> Maurizio
>
More information about the lambda-dev
mailing list