Package io.atlassian.fugue
Class Option.None
- All Implemented Interfaces:
Effect.Applicant<Object>,Maybe<Object>,Serializable,Iterable<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
FieldsModifier and TypeFieldDescriptionprivate static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanTests whether the option contains a given value as an element.<B> BIf this is a some value apply the some function, otherwise get the None value.voidDeprecated.voidget()Get the value if defined.getOrError(Supplier<String> err) Get the value or throws an error with the supplied message if not defined.getOrThrow(Supplier<X> ifUndefined) Get the value or throws the supplied throwable if not defined.booleanIf the type contains a value return true.private ObjectCreate anOptionalfrom this option.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, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
spliterator
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
NONE
-
-
Constructor Details
-
None
None()
-
-
Method Details
-
fold
Description copied from class:OptionIf this is a some value apply the some function, otherwise get the None value. -
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
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
Description 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.
-
foreach
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
-
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<Object>- Returns:
Optional.of(Object)with the value if defined and not null,Optional.empty()if not defined.
-
toStream
Description copied from class:OptionCreate aStreamfrom this option.- Specified by:
toStreamin classOption<Object>- Returns:
Stream.of(Object)with the value if defined,Stream.empty()if not defined.
-
contains
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
-