RFR 8080418 Add Optional.or()
paul.sandoz at oracle.com
Fri Sep 25 10:58:06 UTC 2015
Please review this change to add a method Optional.or that allows one to better compose optionals:
I also took the opportunity to clear up the JavaDoc, it was a little inconsistent and i personally found it harder to read in source code.
Separately while we are on the topic of Optional i would be interested in opinions on the following changes:
1) add methods that were missing on the primitive specializations; and
2) add to all variants a mapOrElseGet (otherwise known as a “fold”), which is the equivalent of map(mapper).orElseGet(supplier). That is arguably less mind-bending to use when transforming from Optional<T> to Optional<U>.
More information about the core-libs-dev