This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java in General and the fly likes ConcurrentModificationException why here ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "ConcurrentModificationException why here ?" Watch "ConcurrentModificationException why here ?" New topic
Author

ConcurrentModificationException why here ?

Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 353
I get a ConcurrentModificationException, but why here i create a new list

List<String> subListKundeNumre = kundeNumre.subList(0, 999);

And remove elements from the old list:

kundeNumre.subList(0,999).clear();

There is not two threads at the same time .... I can try to do in a other way, but i have to know, why i got this exception, any good ideas ?




// Frank :-)

Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

You don't need multiple threads to get that exception. All you need is for the list to be structurally modified other than through the active iterator. It states this right in the docs for the exception.



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ConcurrentModificationException why here ?