Java API Tutorial - Java AtomicLongArray(long[] array) Constructor








Syntax

AtomicLongArray(long[] array) constructor from AtomicLongArray has the following syntax.

public AtomicLongArray(long[] array)

Example

In the following code shows how to use AtomicLongArray.AtomicLongArray(long[] array) constructor.

/*w w  w . j  a va  2s.c om*/
import java.util.concurrent.atomic.AtomicLongArray;

public class Main {
  public static void main(String[] argv) throws Exception {
    AtomicLongArray atomicLongArray = new AtomicLongArray(new long[]{1L,2L,3L,4L});
    System.out.println(atomicLongArray.addAndGet(2,10L));
    System.out.println(atomicLongArray);
  }
}

The code above generates the following result.