getAndSet

Native
1.3
fun getAndSet(index: Int, newValue: T): T
(source)

Atomically sets the value of the element at the given index to the new value and returns the old value of the element.

Provides sequential consistent ordering guarantees.

Exceptions

IndexOutOfBoundsException - if the index is out of bounds of this array.