Scoped Value orElse?
Andrew Haley
aph-open at littlepinkcloud.com
Fri Mar 31 08:01:09 UTC 2023
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
More information about the loom-dev
mailing list