compareAndSet method

Boolean compareAndSet(
  1. Int index,
  2. T expectedValue,
  3. T newValue
)

Atomically sets the value of the element at the given index to the newValue if the current value equals the expectedValue.

Returns true if the operation was successful and false only if the current value of the element was not equal to the expected value.

Implementation

external Boolean compareAndSet(Int index, T expectedValue, T newValue);