|
|
Scala 2.3.3
|
sealed abstract
class
Option
[A]
extends java.lang.Object
with scala.Product
with scala.ScalaObject
Option
are either instances of case class Some or it is case
object None.| Constructor Summary | |
def
this
|
|
| Def Summary | |
def
elements
: scala.Iterator[A]
An singleton iterator returning the option's value if it is nonempty or the empty iterator if the option is empty. |
|
def
filter
(p: (A) => scala.Boolean)
: scala.Option[A]
If the option is nonempty and the given predicate p
yields false on its value, return None.
Otherwise return the option value itself.
|
|
def
flatMap
[B]
(f: (A) => scala.Option[B])
: scala.Option[B]
If the option is nonempty, return a function applied to its value. Otherwise return None. |
|
def
foreach
(f: (A) => scala.Unit)
: scala.Unit
Apply the given procedure f to the option's value,
if it is nonempty. Do nothing if it is empty.
|
|
def
get
[B >: A]
(default: B)
: B
|
|
abstract
|
def
get
: A
get the value of this option. @requires that the option is nonEmpty. |
def
getOrElse
[B >: A]
(default: => B)
: B
If the option is nonempty return its value, otherwise return the result of evaluating a default expression. |
|
def
isDefined
: scala.Boolean
True if the option is a Some(...) false otherwise.
|
|
abstract
|
def
isEmpty
: scala.Boolean
True if the option is the None value, false otherwise.
|
def
map
[B]
(f: (A) => B)
: scala.Option[B]
If the option is nonempty, return a function applied to its value, wrapped in a Some i.e. Some(f(this.get)).
Otherwise return None.
|
|
def
orElse
[B >: A]
(alternative: => scala.Option[B])
: scala.Option[B]
If the option is nonempty return it, otherwise return the result of evaluating an alternative expression. |
|
def
toList
: scala.List[A]
A singleton list containing the option's value if it is nonempty or the empty list if the option is empty. |
|
| Def inherited from scala.Product | |
| arity , element, productPrefix |
| Constructor Detail |
| Def Detail |
def
elements
: scala.Iterator[A]
def
filter
(p: (A) => scala.Boolean): scala.Option[A]
p
yields false on its value, return None.
Otherwise return the option value itself.p - the predicate used for testing.
def
flatMap
[B](f: (A) => scala.Option[B]): scala.Option[B]
f - the function to apply
def
foreach
(f: (A) => scala.Unit): scala.Unit
f to the option's value,
if it is nonempty. Do nothing if it is empty.f - the procedure to apply.
def
get
[B >: A](default: B): B
abstract
def
get
: A
Predef.NoSuchElementException - if the option is empty.
default - the default expression.
def
isDefined
: scala.Boolean
Some(...) false otherwise.
abstract
def
isEmpty
: scala.Boolean
None value, false otherwise.
def
map
[B](f: (A) => B): scala.Option[B]
Some(f(this.get)).
Otherwise return None.f - the function to apply
def
orElse
[B >: A](alternative: => scala.Option[B]): scala.Option[B]
alternative - the alternative expression.
def
toList
: scala.List[A]