Leon K
02/19/2020, 2:32 PMMap<K, V>.putAllWith(other: Map<K, V>, remappingFunction: (V, V) -> V): Map<K,V>
equivalent?elizarov
02/19/2020, 2:34 PMDominaezzz
02/19/2020, 2:34 PMMap
is mutable?Leon K
02/19/2020, 2:35 PMLeon K
02/19/2020, 2:36 PM/** merge another map into this map,
* applying the given remapping function too the two values if there is a key-conflict. */
fun <K, V> MutableMap<K, V>.putAllWith(other: Map<K, V>, remappingFn: (V, V) -> V) = other.forEach { (k, v) ->
merge(k, v, remappingFn)
}
Dominaezzz
02/19/2020, 2:42 PMLeon K
02/19/2020, 2:42 PMstdlib
channel then, i've needed it several times and it seems like a good addition!