Can anyone explain the concurrent modification exception in java with example? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone explain the concurrent modification exception in java with example?

10th Dec 2019, 7:28 AM
goutham thota
goutham thota - avatar
2 Answers
+ 6
When one thread iterate the collection and other thread try to modify that collection then this exception comes. Check here with example: https://www.journaldev.com/378/java-util-concurrentmodificationexception
10th Dec 2019, 7:34 AM
A͢J
A͢J - avatar
+ 5
🅰🅹 - ɪ'ᴍ ᴄʀɪᴍɪɴᴀʟʟʏ ɢᴏᴏᴅ! It's not just with multi-threads. This can occur on the same thread when attempting to add or remove an item in a list while iterating through the list.
10th Dec 2019, 7:45 AM
David Carroll
David Carroll - avatar