You are viewing a single comment's thread. Return to all comments →
Java iteration, while maintaining the same list.
public static List<Integer> gradingStudents(List<Integer> grades) { ListIterator<Integer> it = grades.listIterator(); while(it.hasNext()){ int grade = it.next(); if(grade >= 38 && (5 - grade%5) < 3){ it.remove(); it.add(5 - grade%5 + grade); } } return grades; }
Seems like cookies are disabled on this browser, please enable them to open this website
Grading Students
You are viewing a single comment's thread. Return to all comments →
Java iteration, while maintaining the same list.