I wrote this little method to delete all items in a array with a specific value:
public void removeNote2(String r){
for(String file : notes){
if(file == r){
notes.remove(r);
}
}
}
Somehow i always get this error:
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:859)
at java.util.ArrayList$Itr.next(ArrayList.java:831)
at Notebook.removeNote2(Notebook.java:63)
What did i wrong? And what do i have to change?