This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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


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: 358
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: ConcurrentModificationException why here ?
 
It's not a secret anymore!