compareAndSet method
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);