...
The message is clear, do not rely on ConcurrentModificationException
to stop any side effects resulting from modifying an underlying Collection while iterating over it. Notably, the enhanced for
loop (for-each) internally uses an Iterator
.
Noncompliant Code Example
...