snapshotAndMutate

inline fun snapshotAndMutate(mutator: MutableMap<K, V>.() -> Unit): ImmutableMap<K, V>

Mutates this map atomically and returns the previous snapshot. mutator can be evaluated multiple times if a concurrent edit occurs.