com.avsystem.commons.misc
Like Option but implemented as value class (avoids boxing) and treats null as no value. Therefore, there is no equivalent for Some(null).
null
Some(null)
If you need a value-class version of Option which differentiates between no value and null value, use NOpt.
Apply side effect only if Opt is empty.
Apply side effect only if Opt is empty. It's a bit like foreach for Opt.Empty
- code to be executed if opt is empty
the same opt
captionOpt.forEmpty(logger.warn("caption is empty")).foreach(setCaption)
Like Option but implemented as value class (avoids boxing) and treats
null
as no value. Therefore, there is no equivalent forSome(null)
.If you need a value-class version of Option which differentiates between no value and
null
value, use NOpt.