File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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:


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

Joined: Jan 03, 2004
Posts: 6109

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:
subject: ConcurrentModificationException why here ?
It's not a secret anymore!