title: Java : ConcurrentModificationException while iterating over list
body: <p>When I execute the following code, I get ConcurrentModificationException</p>
  
  <pre><code> Collection&lt;String&gt; myCollection = Collections.synchronizedList(new ArrayList&lt;String&gt;(10));
      myCollection.add("123");
      myCollection.add("456");
      myCollection.add("789");
      for (Iterator it = myCollection.iterator(); it.hasNext();) {
          String myObject = (String)it.next();
          System.out.println(myObject);
          myCollection.remove(myObject); 
          //it.remove();
      }
  </code></pre>
  
  <p>Why am I getting the exception, even though I am using  Collections.synchronizedList?</p>
  
  <p>When I change myCollection to </p>
  
  <pre><code>  ConcurrentLinkedQueue&lt;String&gt; myCollection = new ConcurrentLinkedQueue&lt;String&gt;();
  </code></pre>
  
  <p>I don't get that exception.</p>
  
  <p>How is ConcurrentLinkedQueue in java.util.concurrent different from Collections.synchronizedList ?</p>