class CME {
public void misuse(Collection<Object> c) {
Iterator<Object> i = c.iterator();
c.add(new Object());
if (i.hasNext())
i.next();
}
}
Code with Pattern(s):
public class DoNotModify {
public void pattern(Collection<Object> c, Object element) {
Iterator<Object> i = c.iterator();
if (i.hasNext())
i.next();
}
}