Example usage for java.util.concurrent.atomic AtomicIntegerArray weakCompareAndSet

List of usage examples for java.util.concurrent.atomic AtomicIntegerArray weakCompareAndSet

Introduction

In this page you can find the example usage for java.util.concurrent.atomic AtomicIntegerArray weakCompareAndSet.

Prototype

@Deprecated(since = "9")
public final boolean weakCompareAndSet(int i, int expectedValue, int newValue) 

Source Link

Document

Possibly atomically sets the element at index i to newValue if the element's current value == expectedValue , with memory effects as specified by VarHandle#weakCompareAndSetPlain .

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    AtomicIntegerArray atomicIntegerArray = new AtomicIntegerArray(new int[] { 0, 1, 2, 3 });

    atomicIntegerArray.weakCompareAndSet(0, 10, 20);

    System.out.println(atomicIntegerArray);
}