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

Doug Lea dl at cs.oswego.edu
Wed Mar 6 11:24:53 PST 2013


On 03/06/13 13:55, Brian Goetz wrote:
>
> This is a reasonable discussion to have.  Doug's list is not quite exhaustive -- there are also Option-bearing methods on the primitive streams such as min and max -- but its close.
>

I just did a recheck and it seems that all are somehow derivable
(e.g., long min as map to long, then reduce(MAX_VALUE, ...)
except for findFirst/findAny (but including versions for int, long, double).

>> It would be nice
>> to have a calm final discussion about why we would NOT
>> do such an apparently sensible thing!
>
> Agreed.  Willing to have a calm final discussion on these.
>

OK. My position is just to be prudent and conservative in the face
of looming deadlines: The range of applicability, recommended usages, and
API of Optional are still controversial. We've just seen
at least 6 different opinions about it in 24 hrs. Adding a couple
of methods that do not require its use, but still obtain all of
the base functionality of Streams is a small insurance policy
in the face of uncertainty about how it will be received by a wide
audience.

-Doug






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