| Modifier and Type | Method and Description |
|---|---|
default void |
accept(T value)
Deprecated.
Provided to satisfy the
Function interface; use set(T) instead. |
static <T> Box.Nullable<T> |
from(Supplier<T> getter,
Consumer<T> setter)
Creates a
Box.Nullable from a Supplier and a Consumer. |
default <R> Box.Nullable<R> |
map(ConverterNullable<T,R> converter)
Maps one
Box.Nullable to another Box.Nullable, preserving any modify(Function) concurrency guarantees of the underlying Box. |
default T |
modify(Function<? super T,? extends T> mutator)
Shortcut for doing a set() on the result of a get().
|
static <T> Box.Nullable<T> |
of(T init)
Creates a
Box.Nullable holding the given possibly-null value in a non-volatile field. |
static <T> Box.Nullable<T> |
ofNull()
Creates a
Box.Nullable holding null value in a non-volatile field. |
static <T> Box.Nullable<T> |
ofVolatile(T init)
Creates a
Box holding the given value in a volatile field. |
static <T> Box.Nullable<T> |
ofVolatileNull()
Creates a
Box.Nullable holding the null value in a volatile field. |
void |
set(T value)
Sets the value which will later be returned by get().
|
@Deprecated default void accept(@Nullable T value)
Function interface; use set(T) instead.Delegates to set().
default T modify(Function<? super T,? extends T> mutator)
Shortcut for doing a set() on the result of a get().
default <R> Box.Nullable<R> map(ConverterNullable<T,R> converter)
Maps one Box.Nullable to another Box.Nullable, preserving any modify(Function) concurrency guarantees of the underlying Box.
static <T> Box.Nullable<T> ofVolatile(@Nullable T init)
Creates a Box holding the given value in a volatile field.
modify() is just a shortcut for set(function.apply(get())), use AtomicReference if you require atomic semantics.
static <T> Box.Nullable<T> ofVolatileNull()
Creates a Box.Nullable holding the null value in a volatile field.
static <T> Box.Nullable<T> of(@Nullable T init)
Creates a Box.Nullable holding the given possibly-null value in a non-volatile field.
static <T> Box.Nullable<T> ofNull()
Creates a Box.Nullable holding null value in a non-volatile field.
static <T> Box.Nullable<T> from(Supplier<T> getter, Consumer<T> setter)
Creates a Box.Nullable from a Supplier and a Consumer.