Modifier and Type | Method and Description |
---|---|
ImmutableOptionalValue<E> |
asImmutable()
Gets the
ImmutableValue version of this Value such that
all data is duplicated across to the new ImmutableValue . |
OptionalValue<E> |
copy()
Makes an independent copy of this
Value with the same initial
data. |
Value<E> |
or(E defaultValue)
|
OptionalValue<E> |
set(Optional<E> value)
Sets the underlying value to the provided
value . |
OptionalValue<E> |
setTo(E value)
Sets the underlying value, may be null.
|
OptionalValue<E> set(Optional<E> value)
Value
value
.set
in interface Value<Optional<E>>
value
- The value to setValueContainer
OptionalValue<E> setTo(@Nullable E value)
value
- The value to setValue<E> or(E defaultValue)
null
, the default value is returned as a Value
, if
the underlying value is present, the underlying value is returned
as a Value
.defaultValue
- The value to substitute, if the underlying value is
nullValue
with a non-null valueOptionalValue<E> copy()
Value
Value
with the same initial
data. Both this value and the new value will refer to the same object
initially.ImmutableOptionalValue<E> asImmutable()
Value
ImmutableValue
version of this Value
such that
all data is duplicated across to the new ImmutableValue
. Note
that once created, the ImmutableValue
is not going to change.asImmutable
in interface Value<Optional<E>>
ImmutableValue
instance