Returns the result of applying pf
to this UndefOr's contained
value, if this option is
nonempty and pf
is defined for that value.
Tests whether the UndefOr contains a given value as an element.
Tests whether the UndefOr contains a given value as an element.
x.contains(y)
differs from x == y
only in the fact that it will
return false
when x
and y
are both undefined
.
the element to test.
true
if the UndefOr has an element that is equal (as
determined by ==
) to elem
, false
otherwise.
Returns true if this option is nonempty and the predicate
p
returns true when applied to this UndefOr's value.
Returns true if this option is nonempty and the predicate
p
returns true when applied to this UndefOr's value.
Otherwise, returns false.
the predicate to test
Returns this UndefOr if it is nonempty and applying the predicate p
to
this UndefOr's value returns true.
Returns this UndefOr if it is nonempty and applying the predicate p
to
this UndefOr's value returns false.
Returns the result of applying f
to this UndefOr's value if
this UndefOr is nonempty.
Returns the result of applying f
to this UndefOr's
value if the UndefOr is nonempty.
Returns true if this option is empty or the predicate
p
returns true when applied to this UndefOr's value.
Returns true if this option is empty or the predicate
p
returns true when applied to this UndefOr's value.
the predicate to test
Apply the given procedure f
to the option's value,
if it is nonempty.
Apply the given procedure f
to the option's value,
if it is nonempty. Otherwise, do nothing.
the procedure to apply.
flatMap
map
Returns the option's value.
Returns the option's value.
java.util.NoSuchElementException
if the option is empty.
The option must be nonEmpty.
Returns the option's value if the option is nonempty, otherwise
return the result of evaluating default
.
Returns the option's value if the option is nonempty, otherwise
return the result of evaluating default
.
the default expression.
Returns true if the option is not undefined
, false otherwise.
Returns true if the option is not undefined
, false otherwise.
Returns true if the option is undefined
, false otherwise.
Returns true if the option is undefined
, false otherwise.
Returns a singleton iterator returning the UndefOr's value if it is nonempty, or an empty iterator if the option is empty.
Returns the result of applying f
to this UndefOr's
value if this UndefOr is nonempty.
Returns false if the option is undefined, true otherwise.
Returns false if the option is undefined, true otherwise.
Implemented here to avoid the implicit conversion to Iterable.
Returns this UndefOr if it is nonempty,
otherwise return the result of evaluating alternative
.
Returns this UndefOr if it is nonempty,
otherwise return the result of evaluating alternative
.
the alternative expression.
Returns the option's value if it is nonempty,
or null
if it is empty.
Returns the option's value if it is nonempty,
or null
if it is empty.
Although the use of null is discouraged, code written to use
UndefOr must often interface with code that expects and returns nulls.
val initalText: Option[String] = getInitialText val textField = new JComponent(initalText.orNull,20)
Returns a Right
containing the given argument right
if this is empty,
or a Left
containing this UndefOr's value if this UndefOr is nonempty.
Returns a singleton list containing the UndefOr's value if it is nonempty, or the empty list if the UndefOr is empty.
Returns a Some
containing this UndefOr's value
if this UndefOr is nonempty, None otherwise.
Returns a Left
containing the given argument left
if this UndefOr is
empty, or a Right
containing this UndefOr's value if this is nonempty.
Necessary to keep UndefOr from being implicitly converted to
scala.collection.Iterable in for
comprehensions.
Necessary to keep UndefOr from being implicitly converted to
scala.collection.Iterable in for
comprehensions.