Refactor iterators
Status: Beta
Brought to you by:
akapusti
Currently, iterators over collections and maps will make a snapshot of the underlying collection/map at the point of creation. This guarantees the iteration semantics, but incurs a significant penalty if the collection/map iterated over is not modified while iterating.
Instead, consider re-implementing the iterators in such a way that they don't create a snapshot outright, but iterate over the collection/map itself, and either fail-fast or (and this is preferred) make a lazy copy if the collection/map is modified while iterating over it