mapKeys<R> method

KtMap<R, V> mapKeys<R>(
  1. R transform(
    1. KtMapEntry<K, V>
    )
)

Returns a new Map with entries having the keys obtained by applying the transform function to each entry in this Map and the values of this map.

In case if any two entries are mapped to the equal keys, the value of the latter one will overwrite the value associated with the former one.

The returned map preserves the entry iteration order of the original map.

Implementation

KtMap<R, V> mapKeys<R>(R Function(KtMapEntry<K, V>) transform) {
  final mapped = mapKeysTo(linkedMapFrom<R, V>(), transform);
  return mapped;
}