Package akka.japi
Class Option<A>
- java.lang.Object
-
- akka.japi.Option<A>
-
- All Implemented Interfaces:
java.lang.Iterable<A>
- Direct Known Subclasses:
Option.Some
public abstract class Option<A> extends java.lang.Object implements java.lang.Iterable<A>
This class represents optional values. Instances ofOption
are either instances of case classSome
or it is case objectNone
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Option.Some<A>
ClassSome[A]
represents existing values of typeA
.static class
Option.Some$
-
Constructor Summary
Constructors Constructor Description Option()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract scala.Option<A>
asScala()
static <T> Option<T>
fromScalaOption(scala.Option<T> scalaOption)
Converts a Scala Option to a Java Optionabstract A
get()
abstract <B> B
getOrElse(B defaultValue)
Returnsa
if this issome(a)
ordefaultValue
if this isnone
.boolean
isDefined()
abstract boolean
isEmpty()
java.util.Iterator<A>
iterator()
static <A> scala.Option<A>
java2ScalaOption(Option<A> o)
static <A> Option<A>
none()
Option
factory that createsNone
static <A> Option<A>
option(A v)
Option
factory that createsNone
ifv
isnull
,Some(v)
otherwise.static <A> Option<A>
scala2JavaOption(scala.Option<A> o)
static <A> Option<A>
some(A v)
Option
factory that createsSome
-
-
-
Method Detail
-
some
public static <A> Option<A> some(A v)
Option
factory that createsSome
-
none
public static <A> Option<A> none()
Option
factory that createsNone
-
option
public static <A> Option<A> option(A v)
Option
factory that createsNone
ifv
isnull
,Some(v)
otherwise.
-
fromScalaOption
public static <T> Option<T> fromScalaOption(scala.Option<T> scalaOption)
Converts a Scala Option to a Java Option
-
java2ScalaOption
public static <A> scala.Option<A> java2ScalaOption(Option<A> o)
-
scala2JavaOption
public static <A> Option<A> scala2JavaOption(scala.Option<A> o)
-
get
public abstract A get()
-
getOrElse
public abstract <B> B getOrElse(B defaultValue)
Returnsa
if this issome(a)
ordefaultValue
if this isnone
.
-
isEmpty
public abstract boolean isEmpty()
-
isDefined
public boolean isDefined()
-
asScala
public abstract scala.Option<A> asScala()
-
-