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

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

Introduction

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

Prototype

public final long getAndDecrement(int i) 

Source Link

Document

Atomically decrements 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.getAndDecrement(2));
    System.out.println(atomicLongArray);
}