|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectplay.libs.F.Option<T>
public abstract static class F.Option<T>
Represents optional values. Instances of Option are either an instance of Some or the object None.
| Constructor Summary | |
|---|---|
F.Option()
|
|
| Method Summary | ||
|---|---|---|
boolean |
add(java.lang.Object o)
|
|
boolean |
addAll(java.util.Collection<? extends T> c)
|
|
void |
clear()
|
|
abstract T |
get()
Returns the value if defined. |
|
T |
getOrElse(T defaultValue)
Get the value if defined, otherwise return the supplied defaultValue. |
|
abstract boolean |
isDefined()
Is the value of this option defined? |
|
boolean |
isEmpty()
|
|
|
map(F.Function<T,A> function)
Map this option to another value. |
|
static
|
None()
Constructs a None value. |
|
boolean |
remove(java.lang.Object o)
|
|
boolean |
removeAll(java.util.Collection<?> c)
|
|
boolean |
retainAll(java.util.Collection<?> c)
|
|
static
|
Some(T value)
Construct a Some value. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
contains, containsAll, equals, hashCode, iterator, size, toArray, toArray |
| Constructor Detail |
|---|
public F.Option()
| Method Detail |
|---|
public abstract boolean isDefined()
true if the value is defined, otherwise false.public boolean isEmpty()
isEmpty in interface java.util.Collection<T>public abstract T get()
null.public static <T> F.None<T> None()
None value.
public static <T> F.Some<T> Some(T value)
Some value.
value - The value to make optional
T.public T getOrElse(T defaultValue)
defaultValue.
defaultValue - The value to return if the value of this option is not defined
defaultValue.public <A> F.Option<A> map(F.Function<T,A> function)
function - The function to map the option using.
java.lang.RuntimeException - if function threw an Exception. If the exception is a
RuntimeException, it will be rethrown as is, otherwise it will be wrapped in a
RuntimeException.public void clear()
clear in interface java.util.Collection<T>public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<T>public boolean add(java.lang.Object o)
add in interface java.util.Collection<T>public boolean remove(java.lang.Object o)
remove in interface java.util.Collection<T>public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<T>public boolean addAll(java.util.Collection<? extends T> c)
addAll in interface java.util.Collection<T>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||