copyMapTo

inline fun <K, V, W, D : MutableMap<K, W>> Map<out K, V>.copyMapTo(destination: D, transform: (Map.Entry<K, V>) -> W): D

Transforms values of entries of this map with the given transformation and copies resulting entries to the destination map overriding present ones if needed. Is equivalent to

this.mapValues(transform).copyTo(destination)

Receiver

map to be transformed and copied.

Return

the destination.

Parameters

destination

map to receive copies.

transform

generates value of transformed entry using initial entry as an argument. Key of transformed entry is the same as initial entry.