JD.CONCUR is found when an iterator is created for collection A, then something is removed from the collection, but the loop is not stopped. For more information seeConcurrentModificationException

Vulnerability and risk

On the following invocation of the "next" method, the code will throw a ConcurrentModificationException.

Mitigation and prevention

An object under iteration cannot be modified. Elements for removal have to be stored in another collection and removed later, or the collection can be cloned and the iterator used on the cloned version.

Example 1

12     void fixList(Collection col) {
13         for (Iterator iter = col.iterator(); iter.hasNext();) {
14             String el = (String) iter.next();
15             if (el.startsWith("/")) {
16                 col.remove(el);
17             }
18         }
19     }

JD.CONCUR is reported for line 14: Possible 'ConcurrentModificationException' can be thrown by method 'iter.next()' while iterating over 'col'. You cannot remove a collection element while iterating over the same collection.