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

Doug Lea dl at cs.oswego.edu
Fri Mar 15 04:31:26 PDT 2013

On 03/15/13 06:26, Joe Bowbeer wrote:
> Doug,
> I think your point that Optional and non-Optional forms of reduce are already
> provided is significant.
> I noticed that your proposed versions of findFirst and findAny have a Predicate
> argument, but the Optional forms do not:
> T findFirst(Predicate<? super T> predicate, T ifNone);
> Why is this?

It's in the spirit of proposing a minimal change. The predicate
form suffices for all Optional-avoiding search stuff. To reduce
impact by another 50%, it would suffice to ONLY include the "any" form.
   T findAny(Predicate<? super T> predicate, T ifNone);


More information about the lambda-libs-spec-experts mailing list