Optional.or name <was> Re: RFR 8080418 Add Optional.or()

Stephen Colebourne scolebourne at joda.org
Tue Oct 13 20:43:28 UTC 2015

On 12 October 2015 at 08:48, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> Now that the overall documentation changes and functional behaviour of Optional.or has been agreed i would like to see if we can find a better name, suggestions welcome, so lets get our paint brushes out :-)

"or" seems reasonable for this method.

"If a value is present, returns an {@code Optional} describing the
value, otherwise returns an {@code Optional} produced by the supplying

I'd prefer to see "this" mentioned:

"If a value is not present, invoke the specified supplier to provide
the result, otherwise return {@code this}"

While I understand the original form gave some spec wiggle room, it
also made the method far more mysterious.


More information about the core-libs-dev mailing list