public class AtomicIntReferenceArray
extends java.lang.Object
| Constructor and Description |
|---|
AtomicIntReferenceArray(int length)
Creates a new AtomicReferenceArray of the given length, with all
elements initially null.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
compareAndSet(int i,
int expect,
int update)
Atomically sets the element at position
i to the given
updated value if the current value == the expected value. |
int |
get(int i)
Gets the current value at position
i. |
int |
getAndSet(int i,
int newValue)
Atomically sets the element at position
i to the given
value and returns the old value. |
void |
lazySet(int i,
int newValue)
Eventually sets the element at position
i to the given value. |
int |
length()
Returns the length of the array.
|
void |
set(int i,
int newValue)
Sets the element at position
i to the given value. |
public AtomicIntReferenceArray(int length)
length - the length of the arraypublic final int length()
public final int get(int i)
i.i - the indexpublic final void set(int i,
int newValue)
i to the given value.i - the indexnewValue - the new valuepublic final void lazySet(int i,
int newValue)
i to the given value.i - the indexnewValue - the new valuepublic final int getAndSet(int i,
int newValue)
i to the given
value and returns the old value.i - the indexnewValue - the new valuepublic final boolean compareAndSet(int i,
int expect,
int update)
i to the given
updated value if the current value == the expected value.i - the indexexpect - the expected valueupdate - the new valuetrue if successful. False return indicates that
the actual value was not equal to the expected value.