Functions for working with scala.Option objects.
Functions for working with `scala.Option` objects.
(empty? o)Does Option o have a value? Returns true if so, false otherwise.
Arguments:
o: an OptionReturns:
true if v is None, false otherwise
Does Option `o` have a value? Returns true if so, false otherwise. *Arguments*: * `o`: an Option *Returns*: true if `v` is None, false otherwise
(get o)Returns the value wrapped by o.
Although the Scala implementation throws a Predef.NoSuchElementException if called
on an empty Option, Clojure generally avoids throwing on empty gets, instead preferring to return nil.
This function adopts the Clojure behavior, choosing to treat this effectively as a call to getOrNull.
Arguments:
o: an OptionReturns:
the Option's value if non-empty, nil otherwise
Returns the value wrapped by `o`. Although the Scala implementation throws a `Predef.NoSuchElementException` if called on an empty Option, Clojure generally avoids throwing on empty gets, instead preferring to return nil. This function adopts the Clojure behavior, choosing to treat this effectively as a call to `getOrNull`. *Arguments*: * `o`: an Option *Returns*: the Option's value if non-empty, nil otherwise
(option)(option v)Returns an Option with the given value v.
Arguments:
v: the value that the new Option should be defined with.Returns:
Some(v) if v is present and non-null, None otherwise
Returns an Option with the given value `v`. *Arguments*: * `v`: the value that the new Option should be defined with. *Returns*: `Some(v)` if `v` is present and non-null, `None` otherwise
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |