The problem is, my array list is ArrayList<Student>, so I can't search for a specific String (studentID). How do I do this? How do I only search String studentID of each object on the list?
EDIT: (Is there somethin like activeStudentsList.studentID.contains(studentID) ?)

6 Answers
6

Iterate through the list, test if the current student's ID is equal to the one you're looking for. If yes, return true, else continue. At the end of the iteration, return false.

Or, if you want something easier and faster, use a Map<String, Student> instead of the list, storing the students indexed by their ID. You may use a HashMap, or LinkedHashMap if you need to preserve the insertion order like a List does.