mapKeys<K2> method

ImmortalMap<K2, V> mapKeys<K2>(
  1. K2 f(
    1. K key,
    2. V value
    )
)

Returns a new map where all keys of this map are transformed by the given f function in respect to their values.

If multiple entries have the same key after transformation, later occurences overwrite the earlier ones.

Implementation

ImmortalMap<K2, V> mapKeys<K2>(K2 Function(K key, V value) f) =>
    map((key, value) => MapEntry(f(key, value), value));