addAndFetchAt
Atomically adds the given delta to the element of this AtomicIntArray at the given index and returns the new value of the element.
Since Kotlin
2.1Throws
if the index is out of bounds of this array.
Samples
import kotlin.concurrent.atomics.*
fun main() {
//sampleStart
val a = AtomicIntArray(intArrayOf(1, 2, 3))
// Returns the new value after the addition.
println(a.addAndFetchAt(1, 10)) // 12
println(a.loadAt(1)) // 12
println(a.toString()) // [1, 12, 3]
//sampleEnd
}
Atomically adds the given delta to the element of this AtomicIntArray at the given index and returns the new value of the element.
Since Kotlin
2.1Throws
if the index is out of bounds of this array.
Atomically adds the given delta the element of this AtomicIntArray at the given index by and returns the new value of the element.
Has the same memory effects as java.util.concurrent.atomic.AtomicIntegerArray.addAndGet.
Since Kotlin
2.1Throws
if the index is out of bounds of this array.
Atomically adds the given delta to the element of this AtomicIntArray at the given index and returns the new value of the element.
Since Kotlin
2.1Throws
if the index is out of bounds of this array.
Atomically adds the given delta the element of this AtomicIntArray at the given index by and returns the new value of the element.
Since Kotlin
2.1Throws
if the index is out of bounds of this array.
Atomically adds the given delta the element of this AtomicIntArray at the given index by and returns the new value of the element.
Since Kotlin
2.1Throws
if the index is out of bounds of this array.