is new.
java.lang.Objectjava.util.concurrent.atomic.AtomicReferenceArray<E>
public class AtomicReferenceArray<E>
An array of object references in which elements may be updated atomically. See the java.util.concurrent.atomic package specification for description of the properties of atomic variables.
| Constructor Summary | |
|---|---|
AtomicReferenceArray
(
E
Creates
|
|
AtomicReferenceArray
(int length)
Creates
|
|
| Method Summary | |
|---|---|
| boolean |
compareAndSet
(int i,
E
expect,
E
Atomically
sets
element at position
i
|
| E |
get
(int i)
Gets
|
| E |
getAndSet
(int i,
E
Atomically sets
returns
|
void
|
lazySet
(int i,
E
Eventually sets the element at position
i
to the given value.
|
| int |
length
() Returns the length of the array. |
| void |
set
(int i,
E
Sets
|
| String |
toString
() Returns the String representation of the current values of array. |
| boolean |
weakCompareAndSet
(int i,
E
expect,
E
Atomically
sets
element at position
i
|
| Methods inherited from class java.lang. Object |
|---|
| clone , equals , finalize , getClass , hashCode , notify , notifyAll , wait , wait , wait |
| Constructor Detail |
|---|
public AtomicReferenceArray(int length)
Creates
public AtomicReferenceArray(E[] array)
Creates
| Method Detail |
|---|
public final int length()
public final E get(int i)
Gets
public final void set(int i,
E newValue)
Sets
lazySet
public final void
lazySet
(int i,
E
newValue)
Eventually sets the element at position
i
to the given value.
Parameters:
i - the index
newValue - the new value
Since:
1.6
public final E getAndSet(int i,
E newValue)
Atomically sets
returns
public final boolean compareAndSet(int i,
E expect,
E update)
Atomically sets the element at position
i
to the given updated value if the current value
==
the expected value.
public final boolean weakCompareAndSet(int i,
E expect,
E update)
Atomically sets the element at position
i
to the given updated value if the current value
==
the expected value. May fail spuriously.
public String toString()