atomicArrayOfNulls
Returns a new AtomicArray of the given type with the given size, initialized with null values.
Since Kotlin
2.2Throws
if the specified size is negative.
Samples
import kotlin.concurrent.atomics.*
import kotlin.concurrent.atomics.AtomicArray
import kotlin.test.assertFailsWith
fun main() {
//sampleStart
val array = atomicArrayOfNulls<String>(3)
println(array.toString()) // [null, null, null]
println(atomicArrayOfNulls<String>(0).toString()) // []
// Size should be non-negative
// atomicArrayOfNulls<String>(-1) // will fail with RuntimeException
//sampleEnd
}