E - The type of elementpublic interface ImmutableOptionalValue<E> extends ImmutableValue<Optional<E>>
ImmutableValue that can be Optional such that
the underlying value may be present or null.| Modifier and Type | Method and Description |
|---|---|
OptionalValue<E> |
asMutable()
Creates a mutable
Value for this ImmutableValue. |
ImmutableOptionalValue<E> |
instead(E value)
Creates a new
ImmutableOptionalValue with the provided value,
may be null. |
ImmutableValue<E> |
or(E value)
Provides the value such that if the underlying value is
null, the default value is returned as an
ImmutableValue, if the underlying value is present, the
underlying value is returned as a ImmutableValue. |
ImmutableOptionalValue<E> |
transform(Function<Optional<E>,Optional<E>> function)
Retrieves the underlying value for this
ImmutableValue and
applies the given Function onto that value, after which, the
product is sent to a new ImmutableValue replacing this one. |
ImmutableOptionalValue<E> |
with(Optional<E> value)
Creates a new
ImmutableValue with the given E typed
value, such that if the owning ValueContainer is immutable, the
ValueContainer too is recreated as a new instance with the new
ImmutableValue. |
ImmutableOptionalValue<E> with(Optional<E> value)
ImmutableValueImmutableValue with the given E typed
value, such that if the owning ValueContainer is immutable, the
ValueContainer too is recreated as a new instance with the new
ImmutableValue.with in interface ImmutableValue<Optional<E>>value - The value to replaceValueContainer, a new instance if it too is
immutableImmutableOptionalValue<E> transform(Function<Optional<E>,Optional<E>> function)
ImmutableValueImmutableValue and
applies the given Function onto that value, after which, the
product is sent to a new ImmutableValue replacing this one.
If the ValueContainer too is immutable, a new instance of
the ValueContainer may be created. If the ValueContainer
is mutable, the same instance of the ValueContainer is retained.
transform in interface ImmutableValue<Optional<E>>function - The function to apply onto the existing valueValueContainer, a new instance if it too is
immutableImmutableOptionalValue<E> instead(@Nullable E value)
ImmutableOptionalValue with the provided value,
may be null.value - The valueImmutableValue<E> or(E value)
null, the default value is returned as an
ImmutableValue, if the underlying value is present, the
underlying value is returned as a ImmutableValue.value - The value to substitute, if the underlying value is
nullImmutableValue with a non-null valueOptionalValue<E> asMutable()
ImmutableValueValue for this ImmutableValue.asMutable in interface ImmutableValue<Optional<E>>