Package io.atlassian.fugue
Class Option.None
- java.lang.Object
-
- io.atlassian.fugue.Option<java.lang.Object>
-
- io.atlassian.fugue.Option.None
-
- All Implemented Interfaces:
Effect.Applicant<java.lang.Object>,Maybe<java.lang.Object>,java.io.Serializable,java.lang.Iterable<java.lang.Object>
static final class Option.None extends Option<java.lang.Object>
One of the big two actual implementation classes.- Since:
- 4.2.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.atlassian.fugue.Option
Option.None, Option.Some<A>
-
-
Field Summary
Fields Modifier and Type Field Description private static Option<java.lang.Object>NONEprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description None()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancontains(java.lang.Object elem)Tests whether the option contains a given value as an element.<B> Bfold(java.util.function.Supplier<? extends B> none, java.util.function.Function<? super java.lang.Object,? extends B> some)If this is a some value apply the some function, otherwise get the None value.voidforeach(Effect<? super java.lang.Object> effect)Deprecated.voidforEach(java.util.function.Consumer<? super java.lang.Object> effect)java.lang.Objectget()Get the value if defined.java.lang.ObjectgetOrError(java.util.function.Supplier<java.lang.String> err)Get the value or throws an error with the supplied message if not defined.<X extends java.lang.Throwable>
java.lang.ObjectgetOrThrow(java.util.function.Supplier<X> ifUndefined)Get the value or throws the supplied throwable if not defined.booleanisDefined()If the type contains a value return true.private java.lang.ObjectreadResolve()java.util.Optional<java.lang.Object>toOptional()Create anOptionalfrom this option.java.util.stream.Stream<java.lang.Object>toStream()Create aStreamfrom this option.-
Methods inherited from class io.atlassian.fugue.Option
defined, equals, exists, filter, filterNot, flatMap, forall, fromOptional, getOr, getOrElse, getOrElse, getOrNull, hashCode, isEmpty, iterator, map, none, none, noneSupplier, option, orElse, orElse, some, toLeft, toRight, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
NONE
private static final Option<java.lang.Object> NONE
-
-
Method Detail
-
fold
public <B> B fold(java.util.function.Supplier<? extends B> none, java.util.function.Function<? super java.lang.Object,? extends B> some)Description copied from class:OptionIf this is a some value apply the some function, otherwise get the None value.
-
get
public java.lang.Object get()
Description copied from interface:MaybeGet the value if defined. Throw an exception otherwise.- Returns:
- the wrapped value
-
isDefined
public boolean isDefined()
Description copied from interface:MaybeIf the type contains a value return true.- Returns:
trueif this holds a value,falseotherwise.
-
getOrError
public java.lang.Object getOrError(java.util.function.Supplier<java.lang.String> err)
Description copied from interface:MaybeGet the value or throws an error with the supplied message if not defined.Used when absolutely sure this
is defined.- Parameters:
err- the message for the error.- Returns:
- the contained value.
-
getOrThrow
public <X extends java.lang.Throwable> java.lang.Object getOrThrow(java.util.function.Supplier<X> ifUndefined) throws X extends java.lang.ThrowableDescription copied from interface:MaybeGet the value or throws the supplied throwable if not defined.Used when absolutely sure this
is defined.- Type Parameters:
X- exception type- Parameters:
ifUndefined- the supplier of the throwable.- Returns:
- the contained value.
- Throws:
X- the throwable the supplier creates if there is no value.X extends java.lang.Throwable
-
foreach
@Deprecated public void foreach(Effect<? super java.lang.Object> effect)
Deprecated.Description copied from interface:Effect.ApplicantPerform the given side-effect for each contained element.- Parameters:
effect- the input to use for performing the effect.
-
forEach
public void forEach(java.util.function.Consumer<? super java.lang.Object> effect)
-
toOptional
public java.util.Optional<java.lang.Object> toOptional()
Description copied from class:OptionCreate anOptionalfrom this option. Will throw aNullPointerExceptionif this option is defined and contains a null value.- Specified by:
toOptionalin classOption<java.lang.Object>- Returns:
Optional.of(Object)with the value if defined and not null,Optional.empty()if not defined.
-
toStream
public java.util.stream.Stream<java.lang.Object> toStream()
Description copied from class:OptionCreate aStreamfrom this option.
-
contains
public boolean contains(java.lang.Object elem)
Description copied from interface:MaybeTests whether the option contains a given value as an element.- Parameters:
elem- the element to test- Returns:
trueif the option has an element that is equal to elem,falseotherwise
-
readResolve
private java.lang.Object readResolve()
-
-