Apply side effect only if Option is empty.
Apply side effect only if Option is empty. It's a bit like foreach for None
- code to be executed if option is empty
the same option
captionOpt.forEmpty(logger.warn("caption is empty")).foreach(setCaption)
Converts this Option
into Opt
.
Converts this Option
into Opt
. Because Opt
cannot hold null
, Some(null)
is translated to Opt.Empty
.
Converts this Option
into OptArg
.
Converts this Option
into OptArg
. Because OptArg
cannot hold null
, Some(null)
is translated to OptArg.Empty
.
Converts this Option
into OptRef
, changing the element type into boxed representation if
necessary (e.g.
Converts this Option
into OptRef
, changing the element type into boxed representation if
necessary (e.g. Boolean
into java.lang.Boolean
). Because OptRef
cannot hold null
,
Some(null)
is translated to OptRef.Empty
.