Constructor and Description |
---|
ValueHolder(T initialValue)
Creates a new value holder with the given initial value
|
Modifier and Type | Method and Description |
---|---|
void |
accept(T t) |
T |
get() |
static <T> ValueHolder<T> |
of(T initialValue)
Creates a new ValueHolder with the given initial value.
|
void |
set(T value)
Sets the value of this value holder
|
String |
toString() |
public ValueHolder(T initialValue)
initialValue
- sets the value of the value holderpublic static <T> ValueHolder<T> of(T initialValue)
This method can be used instead of a constructor, so that the type parameters don't need to be re-typed.
T
- the type of the value being held by this ValueHolderinitialValue
- sets the value of the value holderpublic void set(T value)
value
- the new value of this value holderCopyright © 2018. All rights reserved.