public final class OptionCompanion extends Object
Option/Some/None.
import static javascalautils.OptionCompanion.Option;
import static javascalautils.OptionCompanion.Some;
import static javascalautils.OptionCompanion.None;
Option<String> option = Option("Life is full of options");
Option<String> some = Some("Some is never None");
Option<String> none = None();
| Modifier and Type | Method and Description |
|---|---|
static <T> None<T> |
None()
Returns an instance of
None. |
static <T> Option<T> |
Option(T value)
Creates an instance of Option.
|
static <T> Some<T> |
Some(T value)
Creates an instance of
Some. |
public static <T> Option<T> Option(T value)
null value is provided then None is returned, else Some containing the provided value.
import static javascalautils.OptionCompanion.Option;
Option<String> option = Option("Life is full of options");
T - The type for the value this Option representsvalue - The value this Option shall representOption.apply(Object)public static <T> Some<T> Some(T value)
Some.
import static javascalautils.OptionCompanion.Some;
Option<String> some = Some("Some is never None");
T - The type for the value this Some representsvalue - The value represented by this SomeSome.Some(Object)public static <T> None<T> None()
None. None, never creates new instances.import static javascalautils.OptionCompanion.None; Option<String> none = None();
T - The type for the value this None representsNoneOption.None(),
Option.empty(),
Option.DEFAULT_NONECopyright © 2015, Peter Nerg Apache License v2.0