RFR 8071670: java.util.Optional: please add a way to specify if-else behavior
Paul Sandoz
paul.sandoz at oracle.com
Thu Feb 12 18:34:30 UTC 2015
On Feb 12, 2015, at 7:27 PM, Louis Wasserman <lowasser at google.com> wrote:
> I get that ifPresent is already available; I'm curious if you examined how often there is actually an "if absent" case in practice, relative to the "only do something if present" case.
>
> If you don't have statistics,
No, since this is still somewhat new. The evaluation was more based on the principle when this is required it is currently rather awkward.
> I could fairly easily get statistics on Google's codebase for what usages of Guava's Optional look like, in terms of how often
>
> if (optional.isPresent()) {
> ...
> } else {
> ...
> }
>
> occurs, relative to
>
> if (optional.isPresent()) {
> ...
> }
> // no else
>
Please, that would be very helpful and interesting.
Thanks,
Paul.
More information about the core-libs-dev
mailing list