replace

actual fun replace(key: K, oldValue: V, newValue: V): Boolean
actual fun replace(key: K, value: V): V?
expect fun replace(key: K, oldValue: V, newValue: V): Boolean

Atomically replaces the entry for a key only if currently mapped to the specified value.

Return

true if the value was replaced

Parameters

key

the key whose mapping is to be replaced

oldValue

the value expected to be associated with the key

newValue

the value to be associated with the key


expect fun replace(key: K, value: V): V?

Atomically replaces the entry for a key only if currently mapped to some value.

Return

the previous value associated with the key, or null if there was no mapping

Parameters

key

the key whose mapping is to be replaced

value

the value to be associated with the key

actual fun replace(key: K, oldValue: V, newValue: V): Boolean
actual fun replace(key: K, value: V): V?
actual fun replace(key: K, oldValue: V, newValue: V): Boolean
actual fun replace(key: K, value: V): V?
actual fun replace(key: K, oldValue: V, newValue: V): Boolean
actual fun replace(key: K, value: V): V?