I have an ArrayList of objects, the object is an instruction class that has the following variables: toDelete, toUse, ID and executed. To have my program finish, I need to return true only when all members of the ArrayList's executed boolean return true.
public boolean getComplete() {
for (int i = 0; i < instructionArea.size(); i++) {
if (instructionArea.get(i).getExecuted() == false) {
instructionsCompleted = false;
return instructionsCompleted;
} else
instructionsCompleted = true;
}
System.out.println(instructionsCompleted);
return instructionsCompleted;
}
This is my work so far, but I know it is wrong, the program does not execute properly. Any help would be appreciated, thank you.
Thank you responses, I actually realized I had some errors in my code elsewhere that was causing this to not work. Instructions were set to "executed" before they were supposed to. Oh well! Thanks everyone