RFR: 8015317: Optional.filter, map, and flatMap

Mike Duigou mike.duigou at oracle.com
Fri Jul 12 18:15:32 UTC 2013


The ? extends Optional is unnecessary in flatMap as Optional is final. Otherwise this looks good.

Mike

On Jul 5 2013, at 14:37 , Henry Jen wrote:

> Hi,
> 
> Please review the webrev at
> 
> http://cr.openjdk.java.net/~henryjen/ccc/8015317.0/webrev/
> 
> Which adds following method to Optional,
> 
> public static <T> Optional<T> ofNullable(T value) {}
> public Optional<T> filter(Predicate<? super T> predicate) {}
> public<U> Optional<U> map(Function<? super T, ? extends U> mapper) {}
> public<U> Optional<U> flatMap(Function<? super T, ? extends Optional<U>>
> mapper) {}
> 
> Also included is some cleanup on javadoc.
> 
> Cheers,
> Henry




More information about the core-libs-dev mailing list