I am looking for help with a portion of my program. I was wondering how I can loop through the entire "students" ArrayList before removing or keeping the "student" in the ArrayList. The updateStatus method parameter is an int and returns a boolean: true if the student has the required amount of credits to graduate, and false if they don't have enough. If you would like me to post my code for the updateStatus (which I know work 100% accurately), I can do so.
Here is the for-loop I am having an issue with:
ArrayList<Student> students = new ArrayList<Student>();
int [] updates = {4, 7, 8, 6, 15, 10, 30, 31, 5, 7, 127, 21}; //this is the array of values being input to updateStatus
for (int i = 0; i < students.size(); i++){
for(Student x: students){
if(x.updateStatus(updates[i])){
System.out.println(students.remove(i)+"\nCongratulations Graduate!");
}
}
}
Thank you so much in advance!