RFR 8080418 Add Optional.or()

Peter Levart peter.levart at gmail.com
Fri Sep 25 14:11:43 UTC 2015

On 09/25/2015 02:30 PM, Paul Sandoz wrote:
>> >There's also another problem. The orElseGet(null) is documented to
>> >work to work fine for non-empty optional
>> >(why on the Earth it was specified this way?).
> Arguably it was a mistake that we did not catch in the frenzy of Java 8 feature freeze. I would like to revert it but existing code might already be reliant on it:-(
> Paul.

It would be of no use if it was specified to throw on non-empty 
Optional. Usually this method is meant to be called on the result of 
another method returning Optional to compose a fluent call chain.

Regards, Peter

More information about the core-libs-dev mailing list