is new.
java.lang.Objectjava.util.concurrent.atomic.AtomicReference<V>
public class AtomicReference<V>
An object reference that may be updated atomically. See the java.util.concurrent.atomic package specification for description of the properties of atomic variables.
| Constructor Summary | |
|---|---|
AtomicReference
()
Creates
|
|
AtomicReference
(
V
Creates
|
|
| Method Summary | |
|---|---|
| boolean |
compareAndSet
(
V
expect,
V
Atomically
sets
|
| V |
get
()
Gets
|
| V |
getAndSet
(
V
Atomically sets
returns
|
| void |
lazySet
Eventually sets
|
void
|
set
(
V
Sets to the given value.
|
| String |
toString
() Returns the String representation of the current value. |
| boolean |
weakCompareAndSet
(
V
expect,
V
Atomically
sets
|
| Methods inherited from class java.lang. Object |
|---|
| clone , equals , finalize , getClass , hashCode , notify , notifyAll , wait , wait , wait |
| Constructor Detail |
|---|
public AtomicReference(V initialValue)
Creates
public AtomicReference()
Creates
| Method Detail |
|---|
public final V get()
Gets
public final void set(V newValue)
Sets
lazySet
public final void
lazySet
(
V
newValue)
Eventually sets to the given value.
Parameters:
newValue - the new value
Since:
1.6
public final boolean compareAndSet(V expect,
V update)
sets
public final boolean weakCompareAndSet(V expect,
V update)
sets
public final V getAndSet(V newValue)
Atomically sets
returns
public String toString()