mapKeysTo

inline fun <K, V, L, D : MutableMap<L, V>> Map<out K, V>.mapKeysTo(destination: D, transform: (Map.Entry<K, V>) -> L, resolve: (key: L, currentValue: V, newValue: V) -> V): D

Populates the given destination map with entries having the keys obtained by applying the transform function to each entry in this map and the values of this map, resolving conflicts with resolve function and returns the destination.

All pairs are added and resolved in order of iteration.

Return

the destination.

Parameters

destination

the destination of the generated key-value pairs.

transform

function which transforms each key-value pair to new key.

resolve

lambda function that resolves merge conflicts which receives some key, its current, and new corresponding values.