Scoped Value orElse?
Josiah Noel
josiahnoel at gmail.com
Fri Mar 31 12:06:40 UTC 2023
Ah, my auto complete wasn't working so I missed it. Carry on.
On Fri, Mar 31, 2023, 3:01 AM Andrew Haley <aph-open at littlepinkcloud.com>
wrote:
> On 3/29/23 06:03, Josiah Noel wrote:
> > isBound is pretty good, but it'd be nice to have something like
> optional's
> > orElse methods to smoothly retrieve a fallback value if the scope is
> > unbound.
>
> Hmmm?
>
> /**
> * Returns the value of this scoped value if bound in the current
> thread, otherwise
> * returns {@code other}.
> *
> * @param other the value to return if not bound, can be {@code null}
> * @return the value of the scoped value if bound, otherwise {@code
> other}
> */
> public T orElse(T other) {
>
> --
> Andrew Haley (he/him)
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> https://keybase.io/andrewhaley
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230331/ac7e1023/attachment-0001.htm>
More information about the loom-dev
mailing list