snapshotAndMutate

inline fun snapshotAndMutate(mutator: MutableList<E>.() -> Unit): ImmutableList<E>

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