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

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

Introduction

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

Prototype

public final long getAndAdd(int i, long delta) 

Source Link

Document

Atomically adds the given value to 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(10);
    System.out.println(atomicLongArray.getAndAdd(2, 10L));
    System.out.println(atomicLongArray.get(0));
}