Getting ConcurrentException when working with list : <p>I am working with below code : </p>

<pre><code>List&lt;String&gt; layerDataList = new ArrayList&lt;String&gt;();
if (layerDataList.isEmpty()) {
  layerDataList.add(layerData);
}

Iterator&lt;String&gt; lir = layerDataList.iterator(); // Iterator created

while (lir.hasNext()) {
  String layerD = lir.next();
  if (layerD != layerData) {
    layerDataList.add(layerData);
  }
}
</code></pre>

<p>I got exception : <code>java.util.ArrayList$Itr.checkForComodification(Unknown Source)</code></p>

<p>What is the issue?</p>
