mapKeys<U> method

  1. @useResult
Map<U, V> mapKeys<U>(
  1. U f(
    1. K key
    )
)

New map with same values, keys transformed by f. Collisions: last wins.

Implementation

@useResult
Map<U, V> mapKeys<U>(U Function(K key) f) =>
    Map<U, V>.fromEntries(entries.map((MapEntry<K, V> e) => MapEntry<U, V>(f(e.key), e.value)));