Returns the result of applying pf
to this js.UndefOr's contained
value, if this option is
nonempty and pf
is defined for that value.
Returns the result of applying pf
to this js.UndefOr's contained
value, if this option is
nonempty and pf
is defined for that value.
Returns js.undefined otherwise.
the partial function.
the result of applying pf
to this js.UndefOr's
value (if possible), or js.undefined.
Tests whether the js.UndefOr contains a given value as an element.
Tests whether the js.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 js.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 js.UndefOr's value.
Returns true if this option is nonempty and the predicate
p
returns true when applied to this js.UndefOr's value.
Otherwise, returns false.
the predicate to test
Returns this js.UndefOr if it is nonempty and applying the predicate p
to
this js.UndefOr's value returns true.
Returns this js.UndefOr if it is nonempty and applying the predicate p
to
this js.UndefOr's value returns true. Otherwise, return js.undefined.
the predicate used for testing.
Returns this js.UndefOr if it is nonempty and applying the predicate p
to
this js.UndefOr's value returns false.
Returns this js.UndefOr if it is nonempty and applying the predicate p
to
this js.UndefOr's value returns false. Otherwise, return js.undefined.
the predicate used for testing.
Returns the result of applying f
to this js.UndefOr's value if
this js.UndefOr is nonempty.
Returns the result of applying f
to this js.UndefOr's value if
this js.UndefOr is nonempty.
Returns js.undefined if this js.UndefOr is empty.
Slightly different from map
in that f
is expected to
return an js.UndefOr (which could be js.undefined).
the function to apply
foreach
map
Returns the result of applying f
to this js.UndefOr's
value if the js.UndefOr is nonempty.
Returns the result of applying f
to this js.UndefOr's
value if the js.UndefOr is nonempty. Otherwise, evaluates
expression ifEmpty
.
the expression to evaluate if empty.
the function to apply if nonempty.
This is equivalent to js.UndefOr map f getOrElse ifEmpty
.
Returns true if this option is empty or the predicate
p
returns true when applied to this js.UndefOr's value.
Returns true if this option is empty or the predicate
p
returns true when applied to this js.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 js.UndefOr's value if it is nonempty, or an empty iterator if the option is empty.
Returns a singleton iterator returning the js.UndefOr's value if it is nonempty, or an empty iterator if the option is empty.
Returns the result of applying f
to this js.UndefOr's
value if this js.UndefOr is nonempty.
Returns the result of applying f
to this js.UndefOr's
value if this js.UndefOr is nonempty.
Otherwise return js.undefined.
the function to apply
This is similar to flatMap
except here,
f
does not need to wrap its result in an js.UndefOr.
foreach
flatMap
Explicitly merge a union type to a supertype (which might not be a union type itself).
Explicitly merge a union type to a supertype (which might not be a union type itself).
This needs evidence that A <: B
.
Returns false if the option is js.undefined, true otherwise.
Returns false if the option is js.undefined, true otherwise.
Implemented here to avoid the implicit conversion to Iterable.
Returns this js.UndefOr if it is nonempty,
otherwise return the result of evaluating alternative
.
Returns this js.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
js.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 js.UndefOr's value if this js.UndefOr is nonempty.
Returns a Right
containing the given argument right
if this is empty,
or a Left
containing this js.UndefOr's value if this js.UndefOr is nonempty.
the expression to evaluate and return if this is empty
toRight
Returns a singleton list containing the js.UndefOr's value if it is nonempty, or the empty list if the js.UndefOr is empty.
Returns a singleton list containing the js.UndefOr's value if it is nonempty, or the empty list if the js.UndefOr is empty.
Returns a Some
containing this js.UndefOr's value
if this js.UndefOr is nonempty, None otherwise.
Returns a Some
containing this js.UndefOr's value
if this js.UndefOr is nonempty, None otherwise.
Returns a Left
containing the given argument left
if this js.UndefOr is
empty, or a Right
containing this js.UndefOr's value if this is nonempty.
Returns a Left
containing the given argument left
if this js.UndefOr is
empty, or a Right
containing this js.UndefOr's value if this is nonempty.
the expression to evaluate and return if this is empty
toLeft
Necessary to keep js.UndefOr from being implicitly converted to
scala.collection.Iterable in for
comprehensions.
Necessary to keep js.UndefOr from being implicitly converted to
scala.collection.Iterable in for
comprehensions.
Value of type A or B (union type).
Scala does not have union types, but they are important to many interoperability scenarios. This type provides a (partial) encoding of union types using implicit evidences.