Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

...