java.util.Optional fields
Paul Benedict
pbenedict at apache.org
Fri Sep 21 06:00:31 PDT 2012
> On Fri, Sep 21, 2012 at 7:19 AM, Vitaly Davidovich <vitalyd at gmail.com>wrote:
> Why not implement this like Guava with two concrete subtypes of Optional:
> Present and Absent? It seems cleaner and I don't think performance will be
> worse as compiler will only ever see two possible receivers and can use a
> PIC to eliminate calls via vtable in those cases.
I think this thread touches on an email I wrote earlier, which is Optional
is not really a good name choice. It's all focusing on its potential lack
of value rather than just being what it is -- a container.
> On Sep 21, 2012 7:42 AM, "Peter Levart" <peter.levart at gmail.com> wrote:
> Maybe the intention was to allow null values to be wrapped in non-empty
> Optional? In that case the check for non-null in constructor is wrong...
Peter, I agree that a present value of null and an absent value (defaults
to null) need to be differentiated. Yes, it looks wrong.
Paul
More information about the lambda-dev
mailing list