Option<A> class
abstract
Simple Option monad implementation
Constructors
- Option()
Properties
Methods
-
contains(
A candidate) → bool -
Return
true
if this Option is a Some and value inside equalcandidate
-
exists(
bool predicate(A a)) → bool -
Return
true
if this option is nonempty and the predicate returns true Otherwise returnfalse
-
filter(
bool predicate(A a)) → Option< A> -
Return current Option if it's nonempty and
predicate
application return true. Otherwise return None -
flatMap<
Z> (Option< Z> f(A a)) → Option<Z> -
Return Application of
f
ona
inside Some if isDefined elseNone
-
fold<
Z> (Z onNone(), Z onSome(A a)) → Z -
Applies
onNone
if this is a None oronSome
if this is a Some of A -
getOrElse(
A? caseElse()) → A? -
Return
a
inside Some else suppliedcaseElse
if None -
map<
Z> (Z f(A a)) → Option< Z> -
Return Some of Application of
f
ona
inside Some if isDefined else None -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
orElse<
B> (Option< B> caseElse()) → Option -
Return inchanged Option if Some else supplied
caseElse
if None -
toEither<
L> (L leftValue) → Either< L, A> - Consider that None is a Left and Some is a Right(a)
-
toLeft(
A caseNone) → Either< A, A> - Return Left from Option
-
toRight(
A caseNone) → Either< A, A> - Return Right from Option
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited