iterator

open operator override fun iterator(): MutableIterator<T>(source)

Creates a new mutable iterator over this set in unspecified order.

Iterator removal is allowed once after each successful next call and preserves that iterator's traversal. External structural mutations invalidate next and remove; hasNext does not validate structural changes. Adding an equal existing element does not invalidate the iterator.

The iterator throws NoSuchElementException from next after exhaustion, and IllegalStateException from next or remove after invalidation, or from remove before next or twice after the same next.

Return

a fresh iterator positioned before the first element.