LinkedHashMap

class LinkedHashMap<K, V> : MutableMap<K, V>
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.

typealias LinkedHashMap = LinkedHashMap<K, V>
typealias LinkedHashMap = HashMap<K, V>

Constructors

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

Constructs an empty LinkedHashMap instance.

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

Constructs an empty LinkedHashMap instance.

LinkedHashMap
Link copied to clipboard
fun <K, V> LinkedHashMap(original: Map<out K, V>)
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
Common
open override fun clear()
JS
open override fun clear()

Removes all elements from this map.

containsKey
Link copied to clipboard
Common
open override fun containsKey(key: K): Boolean
JS
open override fun containsKey(key: K): Boolean

Returns true if the map contains the specified key.

containsValue
Link copied to clipboard
Common
open override fun containsValue(value: V): Boolean
JS
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
JS
open operator override fun equals(other: Any?): Boolean

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

get
Link copied to clipboard
Common
open operator override fun get(key: K): V?
JS
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
JS
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
JS
open override fun hashCode(): Int

Returns the hash code value for this map.

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

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

Common
open override fun isEmpty(): Boolean
put
Link copied to clipboard
Common
open override fun put(key: K, value: V): V?
JS
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
Common
open override fun putAll(from: Map<out K, V>)
remove
Link copied to clipboard
Common
open override fun remove(key: K): V?
JS
open override fun remove(key: K): V?

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

JS
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
JS
open override fun toString(): String
fun toString(entry: Map.Entry<K, V>): String

Properties

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

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

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