is new.
java.lang.Objectjava.util.concurrent.atomic.AtomicIntegerArray
public class AtomicIntegerArray
An int array 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 | |
|---|---|
AtomicIntegerArray
(int length)
Creates
|
|
AtomicIntegerArray
(int[] array)
Creates
|
|
| Method Summary | |
|---|---|
| int |
addAndGet
(int i, int delta) Atomically
adds
the
element at index
i
. |
| boolean |
compareAndSet
(int i, int expect, int update) Atomically
sets
element at position
i
|
| int |
decrementAndGet
(int i) Atomically
decrements
|
| int |
get
(int i)
Gets
|
| int |
getAndAdd
(int i, int delta) Atomically
adds
the
element at index
i
. |
| int |
getAndDecrement
(int i) Atomically
decrements
|
| int |
getAndIncrement
(int i) Atomically
increments
|
| int |
getAndSet
(int i, int newValue)
Atomically sets
returns
|
| int |
incrementAndGet
(int i) Atomically
increments
|
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
|
| String |
toString
() Returns the String representation of the current values of array. |
| boolean |
weakCompareAndSet
(int i, int expect, int update) 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 AtomicIntegerArray(int length)
Creates
public AtomicIntegerArray(int[] array)
Creates
| Method Detail |
|---|
public final int length()
public final int get(int i)
Gets
public final void set(int i,
int newValue)
Sets
lazySet
public final void
lazySet
(int i, int 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 int getAndSet(int i,
int newValue)
Atomically sets
returns
public final 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.
public final boolean weakCompareAndSet(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. May fail spuriously.
public final int getAndIncrement(int i)
increments
value
public final int getAndDecrement(int i)
decrements
value
public final int getAndAdd(int i,
int delta)
adds
the
element at index
i
.
value
public final int incrementAndGet(int i)
increments
value
public final int decrementAndGet(int i)
decrements
value
public final int addAndGet(int i,
int delta)
adds
the
element at index
i
.
value
public String toString()