Loose ends: Optional

Joe Bowbeer joe.bowbeer at gmail.com
Sun Jun 2 23:11:48 PDT 2013

I'd like to see a compare-and-contrast between what is proposed for Java8
and Guava's Optional and Scala's Option.

Is the criticism that Brian is fielding now a replay of prior criticism of
Guava's Optional?


How have Guava's user been dealing with its intentionally more limited
approach?  Have the new methods added in more recent versions helped?

Optional<V> transform(Function<T,V>)
Iterable<T> presentInstances(Iterable<Optional<T>)
Set<T> asSet()



On Sun, Jun 2, 2013 at 6:11 PM, Sam Pullara <spullara at gmail.com> wrote:

> My opinion remains the same, we should have these methods and probably
> a few more.
> Sam
> On Jun 2, 2013, at 6:02 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> >> Is Optional crippled if we consider that it's just an object that
> represent a value or no value ?
> >> I don't think so.
> >
> > Of the people that have an opinion on this subject, you would be in a
> very, very, very, very, very small minority.  I have received over a
> hundred e-mails and tweets on the subject where people are essentially
> saying "optional is crippled without these" -- and none expressing the
> opposite opinion.  I realize this is vastly unscientific, and it represents
> a vanishingly small and self-selected portion of the Java developer base,
> but of the people who care, it is basically lots of people saying "we need
> this" vs a few saying "but if I give it to you, others will misuse it."
> >
> >>> It is something we want to avoid -- I will certainly avoid it in my
> code, and criticize any code I see using this (or any of ten million other
> bad programming techniques.)  The world is full of useful tools that that
> interact dangerously, such as bleach and ammonia or toasters and bathtubs.
> >>
> >> Wrong example, I don't know in US but in France you can not have a
> power outlet too close to a bathlub :)
> >> That's exactly what we are talking about.
> >
> > And extension cords are illegal in France too?  :)
> >
> >> But you can don't add these 3 methods because they send the wrong
> message.
> >
> > I get what you're saying about what message it sends, and that's a
> reasonable thing to worry about.  On the other hand, making toasters
> illegal because we already have bathtubs and extension cords is also
> worrisome.
> >
> > I would like to hear from other members of the EG on this.
> >
> >
> >
> >

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