title: Java and synchronized linked list
body: <p>I have to questions. The first one is why when we run this function we have ConcurrentModificationException ? </p>
  
  <pre><code>public static void testList() {
      List&lt;String&gt; list = new ArrayList&lt;String&gt;();
      list.add("str3");
  
      for (String st : list) {
          if (st.equalsIgnoreCase("str3")) {
              list.remove("str3");
          }
      }
      System.out.println(list);
  }
  </code></pre>
  
  <p>I thing, because enhanced for use Iterator (which checks <code>modificationsCount</code>), but I ask to be sure. Is that the reason for the exception.</p>
  
  <p>The second question is if I use<code>Collections.synchronizedList(new LinkedList&lt;Something&gt;());</code>
  can I use 2 or more enhanced for loops? For example I have to threads and at some time the first one remove element from the collection and at some time the second one add elements in collection. I thing that it should be thread save even when we use iterator (I thing that enhanced for use iterator).<br>
  Thanks in advance.</p>