This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan 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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 339
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 ?
Similar Threads
Sorting with Collator and Collections ??
MultiDimenaional Array sort
My CreateAlias / Restrictions dosent work, i cant figure out why ?
static utility class from servlet
Select clause for listing cities for refined search