WS07
This commit is contained in:
@@ -18,6 +18,8 @@ public class StudentManager {
|
||||
// Hint:
|
||||
// addAll()
|
||||
|
||||
students.addAll(newStudents);
|
||||
|
||||
}
|
||||
|
||||
public Student searchStudent(int id) {
|
||||
@@ -28,6 +30,12 @@ public class StudentManager {
|
||||
|
||||
// Compare IDs
|
||||
|
||||
for (Student student : students) {
|
||||
if (student.getId() == id) {
|
||||
return student;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -39,6 +47,13 @@ public class StudentManager {
|
||||
|
||||
// Remove student
|
||||
|
||||
for (Student student : students) {
|
||||
if (student.getId() == id) {
|
||||
students.remove(student);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -52,4 +67,4 @@ public class StudentManager {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user