entryOf abstract method

  1. @doNotStore
IndexedMapEntry<K, V> entryOf(
  1. K key
)

Returns the map entry for the given key.

If the key is not present in the map, an AbsentMapEntry is returned.

Lifecycle

The returned entry can be used to insert the key-value pair into the map at a specific index, using IndexedMapEntry.setOrUpdate, but should not be stored for later use, as it may become invalid after a map operation.

Example

final map = IndexMap<String, bool>();

final a = map.entryOf('a');
print(a.isPresent); // false
print(a.key); // 'a'
print(a.value); // null

a.setOrUpdate(true);
print(map); // {a: true}

Implementation

@doNotStore
IndexedMapEntry<K, V> entryOf(K key);