wth with arraylist : CocurrentModificationException ?
in
Programming Questions
•
8 months ago
I got a CocurrentModificationException with this:
(I am gonig astray anyway but now this...)
Who can help?
Would a backward for-loop thru the arraylist be a solution?
oh, I think break; instead of exit(); already helped, but why?
edited: oh, I meant return; instead of exit();
Thanks!
- void removeFromArrayList (ArrayList<classInt> myArrayList, int i) {
- for ( classInt currentInt : myArrayList ) {
- if (currentInt.value==i) {
- myArrayList.remove(currentInt);
- exit();
- }
- } // for
- } // func
1