snapshotAndMutate

inline fun snapshotAndMutate(mutator: MutableSet<E>.() -> Unit): ImmutableSet<E>

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