title: Why is there a ConcurrentModificationException even when list is synchronized?
body: <p>I have Android multi-threading application.</p>
  
  <p>There is some probability that two or more triggers might run the same part of code.</p>
  
  <p>I have a list of objects.</p>
  
  <p>I made it to be synchronized by <code>Collections.synchronizedList</code></p>
  
  <pre><code>private List&lt;WmGroupItemSample&gt; mGroupItemSampleList;
  
  mGroupItemSampleList = new ArrayList&lt;WmGroupItemSample&gt;();
  mGroupItemSampleList = Collections.synchronizedList(mGroupItemSampleList);
  </code></pre>
  
  <p>However <strong>sometimes</strong> I get Exception on line:</p>
  
  <pre><code>Collections.sort(mGroupItemSampleList, new GroupItemSampleComparator());
  </code></pre>
  
  <hr>
  
  <pre><code>java.util.ConcurrentModificationException
         at java.util.AbstractList$SimpleListIterator.next(AbstractList.java:62)
         at java.util.Collections.sort(Collections.java:1895)
  </code></pre>
  
  <ul>
  <li>Is this flow legal? </li>
  <li>do I need create the copy and run sort on copy?</li>
  <li>why <code>Collections.synchronizedList</code> doesn't prevent this Exception?</li>
  </ul>
  
  <p><strong>[EDIT]</strong></p>
  
  <p><em>GroupItemSampleComparator</em></p>
  
  <pre><code>public class GroupItemSampleComparator implements java.util.Comparator&lt;WmGroupItemSample&gt; {
  
      public GroupItemSampleComparator() {
          super();        
      }
  
      public int compare(WmGroupItemSample s1, WmGroupItemSample s2) {
         return ( (s2.getStartDate() - s1.getStartDate()) &gt; 0 ) ? (-1) : (1);
      }
  }
  </code></pre>
  
  <p>Thanks,       </p>