Atomically sets the element at index i to newValue and returns the old value, with memory effects as specified by VarHandle.getAndSet.
i
newValue
VarHandle.getAndSet
Parameters:
Returns: the previous value
Diagram: AtomicArray