| OVERVIEW | PACKAGE | CONSTR | FIELDS | METHODS | FRAMES NO FRAMES | INHERITED |
sealed abstract class Option[+ A]
extends
Product
Option
are either instances of case class Some or it is case
object None.
- Matthias Zenger - Martin Odersky - 1.1, 16/01/2007
def this
|
| elements |
def elements
An singleton iterator returning the option's value if it is nonempty
or the empty iterator if the option is empty
|
Iterator[A] | |
| get |
abstract def get
get the value of this option
[details]
@requires that the option is nonEmpty.
|
A | |
| isDefined |
def isDefined
|
Boolean | |
| isEmpty |
abstract def isEmpty
True if the option is the
None value, false otherwise
|
Boolean | |
| productArity |
abstract def productArity
return k for a product
A(x_1,
[details]
|
Int | Product |
| productPrefix |
def productPrefix
By default the empty string
[details]
Implementations may override this
method in order to prepend a string prefix to the result of the
toString methods.
|
String | Product |
| toList |
def toList
A singleton list containing the option's value if it is nonempty
or the empty list if the option is empty
|
List[A] |
| != |
final def !=(arg0 : Any)
o != arg0 is the same as !(o == (arg0))
[details]
|
Boolean | Any |
| != |
final def !=(arg0 : Object)
|
Boolean | AnyRef |
| == |
final def ==(arg0 : Object)
o == arg0 is the same as if (o eq null) arg0 eq null else o
[details]
|
Boolean | AnyRef |
| == |
final def ==(arg0 : Any)
o == arg0 is the same as o
[details]
|
Boolean | Any |
| asInstanceOf |
final def asInstanceOf[T0]
This method is used to cast the receiver object to be of type
T0
[details]
Note that the success of a cast at runtime is modulo Scala's
erasure semantics. Therefore the expression
|
T0 | Any |
| clone |
protected def clone
This method creates and returns a copy of the receiver object
[details]
The default implementation of the
|
Object | AnyRef |
| eq |
final def eq(arg0 : Object)
This method is used to test whether the argument (
arg0) is a reference to the
receiver object (this)
[details]
The
eq method has three other properties.
When overriding the
|
Boolean | AnyRef |
| equals |
def equals(arg0 : Any)
This method is used to compare the receiver object (
this)
with the argument object (arg0) for equivalence
[details]
The default implementations of this method is an equivalence relation:
If you override this method, you should verify that
your implementation remains an equivalence relation.
Additionally, when overriding this method it is often necessary to
override
|
Boolean | AnyRef |
| filter |
def filter(p : (A) => Boolean)
If the option is nonempty and the given predicate
p
yields false on its value, return None
[details]
Otherwise return the option value itself.
|
Option[A] | |
| finalize |
protected def finalize
This method is called by the garbage collector on the receiver object when garbage
collection determines that there are no more references to the object
[details]
The details of when and if the |
Unit | AnyRef |
| flatMap |
def flatMap[B](f : (A) => Option[B])
If the option is nonempty, return a function applied to its value
[details]
Otherwise return None.
|
Option[B] | |
| foreach |
def foreach(f : (A) => Unit)
Apply the given procedure
f to the option's value,
if it is nonempty
[details]
Do nothing if it is empty.
|
Unit | |
| get |
def get[B >: A](default : B)
[details]
|
B | |
| getClass |
final def getClass
Returns a representation that corresponds to the dynamic class of the receiver object
[details]
The nature of the representation is platform dependent.
|
Class[Any] | AnyRef |
| getOrElse |
def getOrElse[B >: A](default : => B)
If the option is nonempty return its value,
otherwise return the result of evaluating a default expression
[details]
|
B | |
| hashCode |
def hashCode
Returns a hash code value for the object
[details]
The default hashing algorithm is platform dependent.
Note that it is allowed for two objects to have identical hash
codes (
|
Int | AnyRef |
| isInstanceOf |
final def isInstanceOf[T0]
This method is used to test whether the dynamic type of the receiver object is
T0
[details]
Note that the test result of the test is modulo Scala's erasure
semantics. Therefore the expression
|
Boolean | Any |
| map |
def map[B](f : (A) => B)
If the option is nonempty, return a function applied to its value,
wrapped in a Some i
[details]
e.
Some(f(this.get)).
Otherwise return None.
|
Option[B] | |
| ne |
final def ne(arg0 : Object)
o
[details]
|
Boolean | AnyRef |
| notify |
final def notify
Wakes up a single thread that is waiting on the receiver object's monitor
|
Unit | AnyRef |
| notifyAll |
final def notifyAll
Wakes up all threads that are waiting on the receiver object's monitor
|
Unit | AnyRef |
| orElse |
def orElse[B >: A](alternative : => Option[B])
If the option is nonempty return it,
otherwise return the result of evaluating an alternative expression
[details]
|
Option[B] | |
| productElement |
abstract def productElement(n : Int)
for a product
A(x_1,
[details]
|
Any | Product |
| synchronized |
final def synchronized[T0](arg0 : T0)
|
T0 | AnyRef |
| toLeft |
def toLeft[X](right : => X)
An
Either that is a Right with the given argument
right if this is empty, or a Left if this is nonempty with the
option's value
|
Either[A, X] with Product |
|
| toRight |
def toRight[X](left : => X)
An
Either that is a Left with the given argument
left if this is empty, or a Right if this is nonempty with the
option's value
|
Either[X, A] with Product |
|
| toString |
def toString
Returns a string representation of the object
[details]
The default representation is platform dependent.
|
String | AnyRef |
| wait |
final def wait
|
Unit | AnyRef |
| wait |
final def wait(arg0 : Long)
|
Unit | AnyRef |
| wait |
final def wait(arg0 : Long, arg1 : Int)
|
Unit | AnyRef |
| OVERVIEW | PACKAGE | CONSTR | FIELDS | METHODS | FRAMES NO FRAMES | INHERITED |