updateKey method
Returns a copy of this map where the key of the entry with key
is
replaced by applying update
to its value if already present.
Overwrites a previous value in the copied map if an entry for the resulting key was already present.
Returns the map unchanged if key
is not present.
Implementation
ImmortalMap<K, V> updateKey(K key, K Function(V value) update) => lookup(key)
.map((value) => remove(key).add(update(value), value))
.orElse(this);