T - The type of values.@EqualityStructural public final class Some<T> extends Object implements OptionType<T>
A value.
OptionType,
Serialized Form| Modifier and Type | Method and Description |
|---|---|
<U> U |
accept(OptionVisitorType<T,U> v)
Accept a visitor.
|
<U,E extends Throwable> |
acceptPartial(OptionPartialVisitorType<T,U,E> v)
Accept a partial visitor.
|
boolean |
equals(Object obj) |
T |
get() |
int |
hashCode() |
boolean |
isNone() |
boolean |
isSome() |
void |
map_(ProcedureType<T> p)
If this value is
Some(x), evaluate p(x). |
<U> OptionType<U> |
map(FunctionType<T,U> f)
|
<E extends Throwable> |
mapPartial_(PartialProcedureType<T,E> p)
If this value is
Some(x), evaluate p(x). |
<U,E extends Throwable> |
mapPartial(PartialFunctionType<T,U,E> f)
|
static <T> Some<T> |
some(T x)
Produce a new
Some value. |
String |
toString() |
public static <T> Some<T> some(T x)
Some value.T - The type of valuesx - The valueSome valuepublic void map_(ProcedureType<T> p)
OptionType If this value is Some(x), evaluate p(x).
Otherwise, do nothing.
map_ in interface OptionType<T>p - The procedurepublic <E extends Throwable> void mapPartial_(PartialProcedureType<T,E> p) throws E extends Throwable
OptionType If this value is Some(x), evaluate p(x).
Otherwise, do nothing.
mapPartial_ in interface OptionType<T>E - The type of exceptions thrown by the procedure.p - The procedureE - Propagated from pE extends Throwablepublic <U> U accept(OptionVisitorType<T,U> v)
OptionTypeaccept in interface OptionType<T>U - The type of values returned by the visitor.v - The visitorpublic <U,E extends Throwable> U acceptPartial(OptionPartialVisitorType<T,U,E> v) throws E extends Throwable
OptionTypeacceptPartial in interface OptionType<T>U - The type of values returned by the visitor.E - The type of exceptions thrown by the visitor.v - The visitorE - If the visitor throws E.E extends Throwablepublic T get()
public <U> OptionType<U> map(FunctionType<T,U> f)
OptionType If this value is Some(x), return Option.of(Object)
with f(x). Otherwise, return None.
map in interface OptionType<T>U - The type of returned values.f - The map function.U.public <U,E extends Throwable> OptionType<U> mapPartial(PartialFunctionType<T,U,E> f) throws E extends Throwable
OptionType If this value is Some(x), return Option.of(Object)
with f(x). Otherwise, return None.
mapPartial in interface OptionType<T>U - The type of returned values.E - The type of exceptions raised.f - The map function.U.E - If f throws E.E extends Throwablepublic boolean isNone()
isNone in interface OptionType<T>true if the current value is None.public boolean isSome()
isSome in interface OptionType<T>true if the current value is Some.Copyright © 2017 <code@io7m.com> http://io7m.com