final class UndefOrOps[A] extends AnyVal
- Alphabetic
- By Inheritance
- UndefOrOps
- AnyVal
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: scala.Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from UndefOrOps[A] to any2stringadd[UndefOrOps[A]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
def
->[B](y: B): (UndefOrOps[A], B)
- Implicit
- This member is added by an implicit conversion from UndefOrOps[A] to ArrowAssoc[UndefOrOps[A]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
final
def
==(arg0: scala.Any): Boolean
- Definition Classes
- Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
final
def
collect[B](pf: PartialFunction[A, B]): UndefOr[B]
Returns the result of applying
pf
to this UndefOr's contained value, if this option is nonempty andpf
is defined for that value. -
def
ensuring(cond: (UndefOrOps[A]) ⇒ Boolean, msg: ⇒ scala.Any): UndefOrOps[A]
- Implicit
- This member is added by an implicit conversion from UndefOrOps[A] to Ensuring[UndefOrOps[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (UndefOrOps[A]) ⇒ Boolean): UndefOrOps[A]
- Implicit
- This member is added by an implicit conversion from UndefOrOps[A] to Ensuring[UndefOrOps[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ scala.Any): UndefOrOps[A]
- Implicit
- This member is added by an implicit conversion from UndefOrOps[A] to Ensuring[UndefOrOps[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): UndefOrOps[A]
- Implicit
- This member is added by an implicit conversion from UndefOrOps[A] to Ensuring[UndefOrOps[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
final
def
exists(p: (A) ⇒ Boolean): Boolean
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.- p
the predicate to test
- Annotations
- @inline()
-
final
def
filter(p: (A) ⇒ Boolean): UndefOr[A]
Returns this UndefOr if it is nonempty and applying the predicate
p
to this UndefOr's value returns true. -
final
def
filterNot(p: (A) ⇒ Boolean): UndefOr[A]
Returns this UndefOr if it is nonempty and applying the predicate
p
to this UndefOr's value returns false. -
final
def
flatMap[B](f: (A) ⇒ UndefOr[B]): UndefOr[B]
Returns the result of applying
f
to this UndefOr's value if this UndefOr is nonempty. - def flatten[B](implicit ev: <:<[A, UndefOr[B]]): UndefOr[B]
-
final
def
fold[B](ifEmpty: ⇒ B)(f: (A) ⇒ B): B
Returns the result of applying
f
to this UndefOr's value if the UndefOr is nonempty. -
final
def
forall(p: (A) ⇒ Boolean): Boolean
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.- p
the predicate to test
- Annotations
- @inline()
-
final
def
foreach[U](f: (A) ⇒ U): Unit
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.- f
the procedure to apply.
- Annotations
- @inline()
- See also
flatMap
map
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from UndefOrOps[A] to StringFormat[UndefOrOps[A]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
-
final
def
get: A
Returns the option's value.
Returns the option's value.
- Annotations
- @inline()
- Exceptions thrown
java.util.NoSuchElementException
if the option is empty.- Note
The option must be nonEmpty.
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
final
def
getOrElse[B >: A](default: ⇒ B): B
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
.- default
the default expression.
- Annotations
- @inline()
-
final
def
isDefined: Boolean
Returns true if the option is not
undefined
, false otherwise.Returns true if the option is not
undefined
, false otherwise.- Annotations
- @inline()
-
final
def
isEmpty: Boolean
Returns true if the option is
undefined
, false otherwise.Returns true if the option is
undefined
, false otherwise.- Annotations
- @inline()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
iterator: Iterator[A]
Returns a singleton iterator returning the UndefOr's value if it is nonempty, or an empty iterator if the option is empty.
-
final
def
map[B](f: (A) ⇒ B): UndefOr[B]
Returns the result of applying
f
to this UndefOr's value if this UndefOr is nonempty. -
final
def
nonEmpty: Boolean
Returns false if the option is undefined, true otherwise.
Returns false if the option is undefined, true otherwise.
- Note
Implemented here to avoid the implicit conversion to Iterable.
-
final
def
orElse[B >: A](alternative: ⇒ UndefOr[B]): UndefOr[B]
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
.- alternative
the alternative expression.
- Annotations
- @inline()
-
final
def
orNull[A1 >: A](implicit ev: <:<[Null, A1]): A1
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.- Annotations
- @inline()
val initalText: Option[String] = getInitialText val textField = new JComponent(initalText.orNull,20)
Example: - val self: UndefOr[A]
-
final
def
toLeft[X](right: ⇒ X): Either[A, X]
Returns a
Right
containing the given argumentright
if this is empty, or aLeft
containing this UndefOr's value if this UndefOr is nonempty. -
def
toList: List[A]
Returns a singleton list containing the UndefOr's value if it is nonempty, or the empty list if the UndefOr is empty.
-
final
def
toOption: Option[A]
Returns a
Some
containing this UndefOr's value if this UndefOr is nonempty, None otherwise. -
final
def
toRight[X](left: ⇒ X): Either[X, A]
Returns a
Left
containing the given argumentleft
if this UndefOr is empty, or aRight
containing this UndefOr's value if this is nonempty. -
def
toString(): String
- Definition Classes
- Any
-
final
def
withFilter(p: (A) ⇒ Boolean): WithFilter[A]
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.- Annotations
- @inline()
-
def
→[B](y: B): (UndefOrOps[A], B)
- Implicit
- This member is added by an implicit conversion from UndefOrOps[A] to ArrowAssoc[UndefOrOps[A]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc