T - the type of the contained objectpublic final class Ref<T>
extends java.lang.Object
| Constructor and Description |
|---|
Ref()
Initializes a null element.
|
Ref(T value)
Initializes the ref with the given value.
|
| Modifier and Type | Method and Description |
|---|---|
T |
get() |
static <U> Ref<U> |
of()
Construct a new reference in empty mode.
|
static <U> Ref<U> |
of(U value)
Construct a new reference of an initial value (type inference helper).
|
T |
replace(T newValue)
Replace the current contents with the new value and return the old value.
|
void |
set(T newValue)
Set the new content.
|
public Ref()
public Ref(T value)
value - the valuepublic T get()
public void set(T newValue)
newValue - the new value to setpublic T replace(T newValue)
newValue - the new valuepublic static <U> Ref<U> of(U value)
U - the type of the valuevalue - the initial valuepublic static <U> Ref<U> of()
U - the type of the contents