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

Mike Duigou mike.duigou at oracle.com
Mon Mar 4 12:29:41 PST 2013


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


More information about the lambda-dev mailing list