Dart API Referencedart:coreLinkedHashMap<K, V>

LinkedHashMap<K, V> interface

Hash map version of the Map interface that preserves insertion order.

interface LinkedHashMap<K, V> extends HashMap<K, V>
    default LinkedHashMapImplementation<K, V> {
  /**
   * Creates a map with the default implementation.
   */
  LinkedHashMap();

  /**
   * Creates a [LinkedHashMap] that contains all key value pairs of [other].
   */
  LinkedHashMap.from(Map<K, V> other);
}

Default class

LinkedHashMapImplementation<K, V>

Extends

HashMap<K, V>

Implemented by

LinkedHashMapImplementation<K, V>

Constructors

new LinkedHashMap() #

Creates a map with the default implementation.

LinkedHashMap();

new LinkedHashMap.from(Map<K, V> other) #

Creates a LinkedHashMap that contains all key value pairs of other.

LinkedHashMap.from(Map<K, V> other);

Properties

final int length #

inherited from Map

The number of {key, value} pairs in the map.

int get length;

Operators

V operator [](K key) #

inherited from Map

Returns the value for the given key or null if key is not in the map. Because null values are supported, one should either use containsKey to distinguish between an absent key and a null value, or use the putIfAbsent method.

V operator [](K key);

void operator []=(K key, V value) #

inherited from Map

Associates the key with the given value.

void operator []=(K key, V value);

Methods

void clear() #

inherited from Map

Removes all pairs from the map.

void clear();

bool containsKey(K key) #

inherited from Map

Returns whether this map contains the given key.

bool containsKey(K key);

bool containsValue(V value) #

inherited from Map

Returns whether this map contains the given value.

bool containsValue(V value);

void forEach(void f(K key, V value)) #

inherited from Map

Applies f to each {key, value} pair of the map.

void forEach(void f(K key, V value));

Collection<K> getKeys() #

inherited from Map

Returns a collection containing all the keys in the map.

Collection<K> getKeys();

Collection<V> getValues() #

inherited from Map

Returns a collection containing all the values in the map.

Collection<V> getValues();

bool isEmpty() #

inherited from Map

Returns true if there is no {key, value} pair in the map.

bool isEmpty();

V putIfAbsent(K key, V ifAbsent()) #

inherited from Map

If key is not associated to a value, calls ifAbsent and updates the map by mapping key to the value returned by ifAbsent. Returns the value in the map.

V putIfAbsent(K key, V ifAbsent());

V remove(K key) #

inherited from Map

Removes the association for the given key. Returns the value for key in the map or null if key is not in the map. Note that values can be null and a returned null value does not always imply that the key is absent.

V remove(K key);