• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error: Concurrent Modification Exception

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys,

I'm getting the following error:



The thing is that I'm not finding where the error is exactly. Here comes my code:



What am I doing that I should not do? What's so wrong? For as far as I know that's the only way of doing what I want. And I still don't see my error.

Anyone could help? Thanks
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your error is clear. While you are iterating over listAcumulador with
ListIterator acumuladorIt, you are applying add and remove methods to
listAcumulador -- this is enough to cause the exception.

I don't understand your code so I can't suggest specific code, but
among your options is to (1) use *ListIterator's* add and remove methods,
or (2) make a copy of your list and iterator over the copy, but
change the original list (be careful if you choose to do this!).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic