withAppliedToKey

inline fun <K, V> Map<in K, V>.withAppliedToKey(key: K, transform: (currentValue: V?) -> V): Map<K, V>

Creates copy of the map and applies the transformation to the value corresponding to the given key in the copy or null instead if it's not present.

Return

the copy of the map.

Parameters

key

key to check.

transform

transformation to apply.