Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Possible to have ConcurrentModificationException with multiple threads?  RSS feed

V Pinto
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Given the following code

Given that at any time an external thread can call remMethod() will I ever get a ConcurrentModificationException regarding the iterator it? I made the current thread to get the lock over the hash object when iterating so, in my understanding, even if an external thread tries to run remMethod() while iterating, wont be possible to get such an exception... I'm missing something?

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!