Where has the map method on Optional moved?

Tim Peierls tim at peierls.net
Tue Feb 26 05:02:55 PST 2013


On Tue, Feb 26, 2013 at 7:49 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:

> Keep Optional, and keep it lean and mean. (At least as lean as the Guava
> Optional.)
>
> I notice Guava's Optional has a transform method:
>

Right -- "at *least* as lean". But leaner is better. I haven't used the
transform method. It feels like the top of the slippery slope that leads to
monstrosities like Map<String, Optional<Integer>>.



> One of the reasons Doug Lea is not an Optional fan is fear of things like
> Collection<Optional<T>>, something that is less likely to happen with a
> minimalist Optional.
>
> Especially so if we make it more difficult by removing the hashcode and
> equals methods.
>

Yes! With docs explaining why.

--tim


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