Can anyone tell me why this method is throwing an unchecked or unsafe exception? I understood that to happen when I try to edit the list I am iterating through... in the below, currentAdvanceTactics etc are not being iterated through at all.
public void tacticMeetsRequirements(ArrayList<Tactics> master) {
for (Tactics a : master) {
if (meetsrequirements(a)) {
if (a.movement.equals("Advance")) {
currentAdvanceTactics.add(a);
} else if (a.movement.equals("Retreat")) {
currentRetreatTactics.add(a);
} else if (a.movement.equals("Guard")) {
currentGuardTactics.add(a);
}
}
}
}
This is how the objects used in the master list are created:
for (int b = 0; b < numberoftactics; b++) {
tactic[b] = new Tactics(parsedTactics[b]);
tacticsMaster.add(tactic[b]);
}
parsedTactics is just raw data which gets read into the different variables.
tacticsMaster is declared as such:
public ArrayList<Tactics> tacticsMaster;
then later when I create the object it is contained within:
this.tacticsMaster = new ArrayList<Tactics>();
The currentAdvanceTactics list etc are all created as such:
public ArrayList currentGuardTactics = new ArrayList<Tactics>();
public ArrayList currentAdvanceTactics = new ArrayList<Tactics>();
public ArrayList currentRetreatTactics = new ArrayList<Tactics>();
Thanks in advance for any help!