Java AtomicLongArray.addAndGet(int i, long delta)

Syntax

AtomicLongArray.addAndGet(int i, long delta) has the following syntax.

public long addAndGet(int i,  long delta)

Example

In the following code shows how to use AtomicLongArray.addAndGet(int i, long delta) method.


import java.util.concurrent.atomic.AtomicLongArray;
// w ww .  ja v  a  2s  .c  o  m
public class Main {
  public static void main(String[] argv) throws Exception {
    AtomicLongArray atomicLongArray = new AtomicLongArray(10);
    System.out.println(atomicLongArray.addAndGet(2,10L));
    System.out.println(atomicLongArray);
  }
}

The code above generates the following result.





















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




AtomicBoolean
AtomicInteger
AtomicIntegerArray
AtomicLong
AtomicLongArray