W3cubDocs

/Kotlin

LinkedHashMap

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

Platform and version requirements: Kotlin 1.1, JVM

open class LinkedHashMap<K, V> : HashMap<K, V>, Map<K, V>

Platform and version requirements: JS

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.

Constructors

<init>

LinkedHashMap()
LinkedHashMap(initialCapacity: Int, loadFactor: Float = 0f)

Constructs an empty LinkedHashMap instance.

LinkedHashMap(original: Map<out K, V>)

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

Properties

size

open val size: Int

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

Inherited Properties

entries

open val entries: MutableSet<MutableEntry<K, V>>

Returns a read-only Set of all key/value pairs in this map.

Functions

clear

open fun clear()

Removes all elements from this map.

containsKey

open fun containsKey(key: K): Boolean

Returns true if the map contains the specified key.

containsValue

open fun containsValue(value: V): Boolean

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

createEntrySet

open fun createEntrySet(): MutableSet<MutableEntry<K, V>>

get

open operator 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.

put

open fun put(key: K, value: V): V?

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

remove

open fun remove(key: K): V?

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

© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-linked-hash-map/