mergeBy

inline fun <K, V1 : W, V2 : W, W> mergeBy(map1: Map<out K, V1>, map2: Map<out K, V2>, resolve: (key: K, value1: V1, value2: V2) -> W): Map<K, W>

Merges the first map and the second map resolving conflicts with resolve lambda.

Precisely, corresponding keys and values of the received maps are put into a new empty map which is returned after afterwards. For every key appearing in both maps corresponding value is a result of the resolve lambda calculated on the key and its corresponding values from the merged maps.

Return

the result of the merge.

Parameters

map1

the first map to merge.

map2

the second map to merge.

resolve

lambda function that resolves merge conflicts.