getAndSet

fun getAndSet(newValue: Long): Long(source)

Atomically sets the value to the given new value and returns the old value.

Since Kotlin

1.3