RFR 8071670: java.util.Optional: please add a way to specify if-else behavior

Paul Sandoz paul.sandoz at oracle.com
Thu Feb 12 18:15:07 UTC 2015


On Feb 12, 2015, at 7:00 PM, Louis Wasserman <lowasser at google.com> wrote:

> How often does the case when you "have a lambda handy already" come up in practice?  If this leads to people using this method instead of ifPresent, that seems wasteful.
> 

A lambda bearing ifPresent is already "present" (sorry!) :-) this is just filling it out to be consistent for a terminal operation with an empty action.


> Guava's Optional succeeded as much for what it left out as what it had in -- I confess this makes me nervous that j.u.Optional is becoming a kitchen sink.
> 

Yes, i most definitely share this concern. I have already closed a few optional issues as will not fix. FWIW I don't plan on adding any more stuff.

Paul.



More information about the core-libs-dev mailing list