copyToBy

inline fun <K, V : W, W, D : MutableMap<K, W>> Map<out K, V>.copyToBy(destination: D, resolve: (key: K, currentValue: W, newValue: V) -> W): D

Copies entries of this map to the destination map merging present entries with new ones using resolve lambda.

Receiver

map to be copied.

Return

the destination.

Parameters

destination

map to receive copies.

resolve

lambda function that resolves overriding. It takes a key, current value corresponding to the key, and a new one and returns value to associate to the key.