ConcurrentHashMap

actual class ConcurrentHashMap<K, V> : MutableMap<K, V>

Android implementation of ConcurrentHashMap that delegates to java.util.concurrent.ConcurrentHashMap. This provides true thread-safe concurrent access with high performance on the Android platform.

Parameters

K

the type of keys maintained by this map

V

the type of mapped values

expect class ConcurrentHashMap<K, V> : MutableMap<K, V>

A thread-safe MutableMap implementation that provides concurrent access. Platform-specific implementations ensure thread safety according to the platform's concurrency model.

Parameters

K

the type of keys maintained by this map (must be non-nullable)

V

the type of mapped values (must be non-nullable)

actual class ConcurrentHashMap<K, V> : MutableMap<K, V>

JVM implementation of ConcurrentHashMap that delegates to java.util.concurrent.ConcurrentHashMap. This provides true thread-safe concurrent access with high performance on the JVM platform.

Parameters

K

the type of keys maintained by this map

V

the type of mapped values

actual class ConcurrentHashMap<K, V> : MutableMap<K, V>

Native implementation of ConcurrentHashMap using atomic operations. This implementation uses AtomicReference for thread-safe access to the underlying map. Note: This provides basic thread safety but may not have the same performance characteristics as the JVM implementation for high-concurrency scenarios.

Parameters

K

the type of keys maintained by this map

V

the type of mapped values

actual class ConcurrentHashMap<K, V> : MutableMap<K, V>

JavaScript implementation of ConcurrentHashMap that uses a regular MutableMap. JavaScript is single-threaded by default, so true concurrency is not needed. This implementation provides the same API but without thread-safety overhead.

Parameters

K

the type of keys maintained by this map

V

the type of mapped values

Constructors

Link copied to clipboard
actual constructor()
actual constructor(initialCapacity: Int)
actual constructor(initialCapacity: Int, loadFactor: Float)
actual constructor(original: Map<K, V>)
expect constructor()
expect constructor(initialCapacity: Int)

Creates a new ConcurrentHashMap with the specified initial capacity.

expect constructor(initialCapacity: Int, loadFactor: Float)

Creates a new ConcurrentHashMap with the specified initial capacity and load factor.

expect constructor(original: Map<K, V>)

Creates a new ConcurrentHashMap containing all mappings from the specified map.

actual constructor()
actual constructor(initialCapacity: Int)
actual constructor(initialCapacity: Int, loadFactor: Float)
actual constructor(original: Map<K, V>)
actual constructor()
actual constructor(initialCapacity: Int)
actual constructor(initialCapacity: Int, loadFactor: Float)
actual constructor(original: Map<K, V>)
actual constructor()
actual constructor(initialCapacity: Int)
actual constructor(initialCapacity: Int, loadFactor: Float)
actual constructor(original: Map<K, V>)

Properties

Link copied to clipboard
actual open override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
expect open override val entries: MutableSet<MutableMap.MutableEntry<K, V>>

Returns a MutableSet view of the mappings contained in this map.

actual open override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
actual open override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
actual open override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
Link copied to clipboard
actual open override val keys: MutableSet<K>
expect open override val keys: MutableSet<K>

Returns a MutableSet view of the keys contained in this map.

actual open override val keys: MutableSet<K>
actual open override val keys: MutableSet<K>
actual open override val keys: MutableSet<K>
Link copied to clipboard
actual open override val size: Int
expect open override val size: Int

Returns the number of key-value mappings in this map.

actual open override val size: Int
actual open override val size: Int
actual open override val size: Int
Link copied to clipboard
actual open override val values: MutableCollection<V>
expect open override val values: MutableCollection<V>

Returns a MutableCollection view of the values contained in this map.

actual open override val values: MutableCollection<V>
actual open override val values: MutableCollection<V>
actual open override val values: MutableCollection<V>

Functions

Link copied to clipboard
actual open override fun clear()
expect open override fun clear()

Removes all of the mappings from this map.

actual open override fun clear()
actual open override fun clear()
actual open override fun clear()
Link copied to clipboard
actual open override fun containsKey(key: K): Boolean
expect open override fun containsKey(key: K): Boolean

Returns true if this map contains a mapping for the specified key.

actual open override fun containsKey(key: K): Boolean
actual open override fun containsKey(key: K): Boolean
actual open override fun containsKey(key: K): Boolean
Link copied to clipboard
actual open override fun containsValue(value: V): Boolean
expect open override fun containsValue(value: V): Boolean

Returns true if this map maps one or more keys to the specified value.

actual open override fun containsValue(value: V): Boolean
actual open override fun containsValue(value: V): Boolean
actual open override fun containsValue(value: V): Boolean
Link copied to clipboard
actual open operator override fun get(key: K): V?
expect open operator override fun get(key: K): V?

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

actual open operator override fun get(key: K): V?
actual open operator override fun get(key: K): V?
actual open operator override fun get(key: K): V?
Link copied to clipboard
actual open override fun isEmpty(): Boolean
expect open override fun isEmpty(): Boolean

Returns true if this map contains no key-value mappings.

actual open override fun isEmpty(): Boolean
actual open override fun isEmpty(): Boolean
actual open override fun isEmpty(): Boolean
Link copied to clipboard
actual open override fun put(key: K, value: V): V?
expect open override fun put(key: K, value: V): V?

Associates the specified value with the specified key in this map.

actual open override fun put(key: K, value: V): V?
actual open override fun put(key: K, value: V): V?
actual open override fun put(key: K, value: V): V?
Link copied to clipboard
actual open override fun putAll(from: Map<out K, V>)
expect open override fun putAll(from: Map<out K, V>)

Copies all of the mappings from the specified map to this map.

actual open override fun putAll(from: Map<out K, V>)
actual open override fun putAll(from: Map<out K, V>)
actual open override fun putAll(from: Map<out K, V>)
Link copied to clipboard
actual fun putIfAbsent(key: K, value: V): V?
expect fun putIfAbsent(key: K, value: V): V?

Atomically associates the specified key with the given value if the key is not already associated with a value.

actual fun putIfAbsent(key: K, value: V): V?
actual fun putIfAbsent(key: K, value: V): V?
actual fun putIfAbsent(key: K, value: V): V?
Link copied to clipboard
actual open override fun remove(key: K): V?
actual fun remove(key: K, value: V): Boolean
expect open override fun remove(key: K): V?

Removes the mapping for a key from this map if it is present.

expect fun remove(key: K, value: V): Boolean

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

actual open override fun remove(key: K): V?
actual fun remove(key: K, value: V): Boolean
actual open override fun remove(key: K): V?
actual fun remove(key: K, value: V): Boolean
actual open override fun remove(key: K): V?
actual fun remove(key: K, value: V): Boolean
Link copied to clipboard
actual fun replace(key: K, value: V): V?
actual fun replace(key: K, oldValue: V, newValue: V): Boolean
expect fun replace(key: K, value: V): V?

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

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.

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?
actual fun replace(key: K, oldValue: V, newValue: V): Boolean