platform-collections
platform-collections copied to clipboard
Only snapshot contents when mutating `iterator()`
~operator fun iterator(): Iterator<..> for the language-level for-each. And fun mutableIterator(): MutableIterator<..> for the manual loop-and-remove case.~
Better idea: detect the first call to remove() and perform the defensive copy then. This only affects Darwin, as JVM and JS support removal while iterating.