public abstract class Option<T> extends Object implements CollectionLike<T>
| Constructor and Description |
|---|
Option() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Option<T> |
apply(T value) |
static <T> Option<T> |
empty() |
abstract Option<T> |
filter(Function1<T,Boolean> f)
Selects all elements of this sequence which satisfy a predicate.
|
abstract <U> Option<U> |
flatMap(Function1<T,Option<U>> f)
Returns the result of applying f to this Option's value if this Option is
nonempty.
|
abstract <U> Function1<Function1<T,U>,U> |
fold(U ifEmpty) |
abstract <U> U |
fold(U ifEmpty,
Function1<T,U> f)
Returns the result of applying $f to this $option's value if the $option
is nonempty.
|
T |
getOrElse(Function0<T> defaultProvider)
Returns the option's value if the option is nonempty, otherwise return
the result of evaluating default.
|
abstract T |
getOrElse(T defaultValue)
Returns the option's value if the option is nonempty, otherwise return
the result of evaluating default.
|
abstract T |
getOrNull()
scala.Option#orNull()
Returns the option's value if it is nonempty, or null if it is empty.
|
abstract boolean |
isDefined()
Returns true if the option is an instance of Some, false otherwise.
|
abstract <U> Option<U> |
map(Function1<T,U> f)
Builds a new collection by applying a function to all elements of this
sequence.
|
static <T> Option<T> |
none() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforeach, isEmpty, toListpublic static <T> Option<T> apply(T value)
public static <T> Option<T> none()
public static <T> Option<T> empty()
public abstract T getOrNull()
public abstract T getOrElse(T defaultValue)
public T getOrElse(Function0<T> defaultProvider) throws Exception
Exceptionpublic abstract boolean isDefined()
public abstract Option<T> filter(Function1<T,Boolean> f)
public abstract <U> Option<U> flatMap(Function1<T,Option<U>> f)
public abstract <U> U fold(U ifEmpty,
Function1<T,U> f)
Copyright © 2015. All rights reserved.