Java AtomicIntegerArray .getAndAdd (int i, int delta)

Syntax

AtomicIntegerArray.getAndAdd(int i, int delta) has the following syntax.

public final int getAndAdd(int i,  int delta)

Example

In the following code shows how to use AtomicIntegerArray.getAndAdd(int i, int delta) method.


/* w ww.  ja  v  a 2 s  .co m*/
import java.util.concurrent.atomic.AtomicIntegerArray;

public class Main {
  public static void main(String[] argv) throws Exception {
    AtomicIntegerArray atomicIntegerArray = new AtomicIntegerArray(new int[]{0,1,2,3});
    
    atomicIntegerArray.getAndAdd(0,10);
    
    System.out.println(atomicIntegerArray);
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.util.concurrent.atomic »




AtomicBoolean
AtomicInteger
AtomicIntegerArray
AtomicLong
AtomicLongArray