Example usage for java.util.concurrent.atomic AtomicLongArray getAndIncrement

List of usage examples for java.util.concurrent.atomic AtomicLongArray getAndIncrement

Introduction

In this page you can find the example usage for java.util.concurrent.atomic AtomicLongArray getAndIncrement.

Prototype

public final long getAndIncrement(int i) 

Source Link

Document

Atomically increments the value of the element at index i , with memory effects as specified by VarHandle#getAndAdd .

Usage

From source file:Main.java

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