Class Option.Some<A>
java.lang.Object
io.atlassian.fugue.Option<A>
io.atlassian.fugue.Option.Some<A>
- All Implemented Interfaces:
Effect.Applicant<A>, Maybe<A>, Serializable, Iterable<A>
One of the big two actual implementation classes.
- Since:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from class Option
Option.None, Option.Some<A> -
Field Summary
Fields -
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.Create anOptionalfrom this option.toStream()Create aStreamfrom this option.Methods inherited from class 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 interface Iterable
spliterator
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
value
-
-
Constructor Details
-
Some
-
-
Method Details
-
fold
Description copied from class:OptionIf this is a some value apply the some function, otherwise get the None value. -
get
-
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<A>- 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<A>- Returns:
Stream.of(Object)with the value if defined,Stream.empty()if not defined.
-
contains
-