another ConcurrentModificationException
<p>I am new to Java and especially to iterating through lists and modifying it's elements. I went through dozens of similar questions, but after many tries nothing worked. 
In the following code sample an exceptions is thrown. It is not related to concurrent thread as I only have one thread. Netbeans output sais that the exception occurs in line 5(CustomerData customer = i.next();) :</p>

<pre><code>CustomerData tempCustomer = new CustomerData("",tagID,0);
tempCustomer.setName(name);
tempCustomer.setSize(size);
for(ListIterator&lt;CustomerData&gt; i = customers.listIterator(); i.hasNext(); )
{
    CustomerData customer = i.next();
    if(customer.getTagID().contains(tagID))
    {
        Object[] options = {"overwrite", "do not overwrite"};
        int n = JOptionPane.showOptionDialog(rootPane, 
                                            "TagID already exists. overwrite?", 
                                            "?", 
                                            JOptionPane.YES_NO_OPTION, 
                                            JOptionPane.QUESTION_MESSAGE, 
                                            null, 
                                            options, 
                                            rootPane);
       if ( n == JOptionPane.YES_OPTION ){
           i.set(tempCustomer); 
       }
    }
    else{
        addCustomer();
    }
}
</code></pre>

<p>The whole code is only supposed to check if the element has matching tagID and if it does, replace two values (name and size) in it. Initially I tried to use <code>setName()</code> and <code>setSize()</code> inside the for loop on the element, but after it didn't work and after reading other related questions, I assigned the values to temporary object before the loop and the used the iterator's set method to replace current element. But still no success and it even seems it never gets that far because the exception comes after line 5...</p>
