I have searched for an answer to my problem but nothing has worked. This is my code.
public ArrayList<Exercise> checkList()
{
Criteria a = this.getCriteria();
ArrayList<Exercise> z = this.getExercise();
for(Exercise c : z)
{
if(!compareSkillLevel(c,a)|| !compareEquipment(c)|| !compareFocus(c)
|| !compareTraining(c))
z.remove(c);
}
return z;
}
After running this I get a Conncurrent Modification Exeption.
Exception in thread "main" java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:859)
at java.util.ArrayList$Itr.next(ArrayList.java:831)
at randomworkout.List.checkList(List.java:161)
at Main.main(Main.java:46)
How do I solve this?