renameKeys method
New map with keys renamed according to oldToNew.
Implementation
@useResult
Map<K, V> renameKeys(Map<K, K> oldToNew) {
final Map<K, V> out = Map<K, V>.from(this);
for (final MapEntry<K, K> e in oldToNew.entries) {
if (out.containsKey(e.key)) {
final v = out.remove(e.key);
if (v != null) out[e.value] = v;
}
}
return out;
}