|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.ninjacat.drama.Option<T>
T - type of the valuepublic class Option<T>
Optional value.
| Method Summary | ||
|---|---|---|
static
|
absent()
Creates optional value which is unset |
|
T |
get()
|
|
boolean |
isPresent()
|
|
static
|
of(T value)
Creates optional value from supplied parameter |
|
T |
or(T alternative)
|
|
T |
orNull()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T> Option<T> absent()
T - type of the value
public static <T> Option<T> of(T value)
T - type of the valuevalue - value to wrap into Option. May be null
public boolean isPresent()
public T or(T alternative)
alternative - value to be used if this optional is absent
public T orNull()
public T get()
IllegalStateException - if option does not hold anything
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||