MapRenameKey<K, V> extension

Rename keys in a copy.

on

Methods

renameKey(K oldKey, K newKey) Map<K, V>

Available on Map<K, V>, provided by the MapRenameKey extension

New map with oldKey renamed to newKey; unchanged if oldKey absent. Audited: 2026-06-12 11:26 EDT
renameKeys(Map<K, K> oldToNew) Map<K, V>

Available on Map<K, V>, provided by the MapRenameKey extension

New map with keys renamed according to oldToNew. Keys absent from oldToNew are kept as-is. If two keys map to the same target, the later one in iteration order wins (a genuine collision is inherently lossy). Audited: 2026-06-12 11:26 EDT