move method
- K oldKey,
- K newKey
Moves the element at the oldKey
to the newKey
replacing the existing
element, if any.
No-op, if element at the oldKey
doesn't exist.
Implementation
void move(K oldKey, K newKey) {
V? v = super.remove(oldKey);
if (v != null) {
V? n = super[newKey];
if (n != null && n != v) {
_changes.add(MapChangeNotification<K, V>.removed(newKey, n));
}
super[newKey] = v;
_changes.add(MapChangeNotification<K, V>.updated(newKey, oldKey, v));
}
}