RFR 8071670: java.util.Optional: please add a way to specify if-else behavior
Paul Sandoz
paul.sandoz at oracle.com
Tue Feb 3 16:07:43 UTC 2015
On Feb 3, 2015, at 4:47 PM, Stephen Colebourne <scolebourne at joda.org> wrote:
> Can't say I've used isPresent() much, as map()/flatMap()/orElse() take
> care of most use cases.
>
Yes, i suspect terminal action-based processing is less used than value transformation.
> What is an issue is that the primitive optional classes do not have
> ofNullable(), filter(), map() or flatMap().
I dunno about the first, that would seem a little odd to me.
Note the concept of ifPresent is already on all Optional variants. Same applies to the difficulties encountered with flatMap.
> It seems odd to be adding
> an additional new method to the primitive optional classes without
> rounding out the missing methods to reach feature parity. I've heard
> people complaining about the missing methods on more than one
> occasion....
>
I recall the discussions around Optional consumed quite a bit of design discussion budget :-) so we tried to keep things to a minimum set.
Do you wanna log an issue for those missing methods?
Paul.
More information about the core-libs-dev
mailing list