hg: lambda/lambda/jdk: Cleanup in Optional
Remi Forax
forax at univ-mlv.fr
Fri Nov 16 06:58:03 PST 2012
On 11/16/2012 02:49 PM, Vitaly Davidovich wrote:
>
> the constructor is private now so equals() is correct but I agree that
> marking as final and doing instanceof is more explicit.
>
You're right, but because I want to have the last word, the current
implementation still allow to create an inner class that extends Optional.
> Also, doing exact class check is useful when you want symmetry in
> equality. Otherwise, Base.equals(Derived) may return true but
> Derived.equals(Base) will return false.
>
That's by the way the main arguments against having a language with
operator overloading but without explicit conversion.
> Sent from my phone
>
Rémi
> On Nov 16, 2012 6:14 AM, "Remi Forax" <forax at univ-mlv.fr
> <mailto:forax at univ-mlv.fr>> wrote:
>
> On 11/15/2012 11:19 PM, brian.goetz at oracle.com
> <mailto:brian.goetz at oracle.com> wrote:
> > Changeset: ab258565c0c9
> > Author: briangoetz
> > Date: 2012-11-15 17:19 -0500
> > URL: http://hg.openjdk.java.net/lambda/lambda/jdk/rev/ab258565c0c9
> >
> > Cleanup in Optional
> >
> > ! src/share/classes/java/util/Optional.java
> > ! src/share/classes/java/util/streams/ops/FindAnyOp.java
> > ! src/share/classes/java/util/streams/ops/FindFirstOp.java
> > ! src/share/classes/java/util/streams/ops/SeedlessFoldOp.java
> >
> >
>
> Brian,
> or Optional should be final, or you have to change equals() to do an
> instanceof check.
> but currently the implementation of equals is not correct.
>
> cheers,
> Rémi
>
More information about the lambda-dev
mailing list