LinkedHashMap

expect class LinkedHashMap<K, V> : MutableMap<K, V>
actual typealias LinkedHashMap = LinkedHashMap<K, V>
actual open class LinkedHashMap<K, V> : HashMap<K, V> , MutableMap<K, V>

Hash table based implementation of the MutableMap interface, which additionally preserves the insertion order of entries during the iteration.

The insertion order is preserved by maintaining a doubly-linked list of all of its entries.

actual typealias LinkedHashMap = HashMap<K, V>

Constructors

LinkedHashMap
Link copied to clipboard
expect fun LinkedHashMap()
actual fun LinkedHashMap()

Constructs an empty LinkedHashMap instance.

LinkedHashMap
Link copied to clipboard
expect fun LinkedHashMap(initialCapacity: Int)
actual fun LinkedHashMap(initialCapacity: Int)
LinkedHashMap
Link copied to clipboard
expect fun LinkedHashMap(initialCapacity: Int, loadFactor: Float = 0.0f)
actual fun LinkedHashMap(initialCapacity: Int, loadFactor: Float = 0.0f)

Constructs an empty LinkedHashMap instance.

LinkedHashMap
Link copied to clipboard
expect fun <K, V> LinkedHashMap(original: Map<out K, V>)
actual fun <K, V> LinkedHashMap(original: Map<out K, V>)

Constructs an instance of LinkedHashMap filled with the contents of the specified original map.

Functions

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

Removes all elements from this map.

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

Returns true if the map contains the specified key.

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

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

equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Compares this map with other instance with the ordered structural equality.

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

Returns the value corresponding to the given key, or null if such a key is not present in the map.

getOrDefault
Link copied to clipboard
open fun getOrDefault(key: K, defaultValue: V): V

Returns the value corresponding to the given key, or defaultValue if such a key is not present in the map.

Since Kotlin

1.1
hashCode
Link copied to clipboard
open override fun hashCode(): Int

Returns the hash code value for this map.

isEmpty
Link copied to clipboard
expect open override fun isEmpty(): Boolean
open override fun isEmpty(): Boolean

Returns true if the map is empty (contains no elements), false otherwise.

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

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

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

Removes the specified key and its corresponding value from this map.

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

Removes the entry for the specified key only if it is mapped to the specified value.

Since Kotlin

1.1
toString
Link copied to clipboard
open override fun toString(): String
fun toString(entry: Map.Entry<K, V>): String

Properties

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

Returns the number of key/value pairs in the map.

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