Optional.or name Re: RFR 8080418 Add Optional.or() (original) (raw)
Paul Sandoz paul.sandoz at oracle.com
Mon Oct 12 07:48:13 UTC 2015
- Previous message: RFR: 8073519: schemagen does not report errors while generating xsd files
- Next message: Optional.or name Re: RFR 8080418 Add Optional.or()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 25 Sep 2015, at 12:58, Paul Sandoz <Paul.Sandoz at oracle.com> wrote:
Hi, Please review this change to add a method Optional.or that allows one to better compose optionals: http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8080418-optional-or/webrev/ 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.
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 :-)
I suggest we avoid commenting on comments, otherwise this thread could get out of control.
“Optional.or” is the best name so far i have come up with. The “orElse” prefix is reversed for terminal methods and i don’t want to overload that.
--
Alternative suggestions:
“Optional.otherwise” A bit of a mouthful, but reasonably accurate
“Optional.mapElse" The name is not entirely accurate since it accepts a Suppler not a T, a more accurate name would be the following alternative.
“Optional.flatMapElse" This name is likely to confuse.
Paul.
- Previous message: RFR: 8073519: schemagen does not report errors while generating xsd files
- Next message: Optional.or name Re: RFR 8080418 Add Optional.or()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]