RFR : JDK-8001642 : Add Optional<T>, OptionalDouble, OptionalInt, OptionalLong

Alan Bateman Alan.Bateman at oracle.com
Tue Mar 5 07:12:31 PST 2013


On 04/03/2013 20:29, Mike Duigou wrote:
> Hello All;
>
> This patch introduces Optional container objects to be used by the lambda streams libraries for returning results.
>
> The reference Optional type, as defined, intentionally does not allow null values. null may be used with the Optional.orElse() method.
>
> All of the Optional types define hashCode() and equals implementations. Use of Optional types in collections should be generally discouraged but having useful equals() and hashCode() is ever so convenient.
>
> http://cr.openjdk.java.net/~mduigou/JDK-8001642/0/webrev/
>
> Mike
Just a couple of small things.

Will the docs build complain about the unknown taglets? (@apiNote, 
@implNote ...)

Optional.of(T) has two @param tags.

In orElseGet currently reads "Supplier who's result is returned ..." but 
I assume you want the possessive, hence  "whose".

Are you planning to include a test? I realize this will get a good 
workout once the streams work come in.

-Alan.


More information about the lambda-dev mailing list