public Student getStudent(int id) { Student student = null; for (Student s : this.students) { if (s.getId() == id) { student = s; } } return student; }
public Student modifyNationality(int id, String nationality) { Student student = null; for (Student s : this.students) { if (s.getId() == id) { s.setNationality(nationality); student = s; } } return student; }
public Student modifyAge(int id, int age) { Student student = null; for (Student s : this.students) { if (s.getId() == id) { s.setAge(age); student = s; } } return student; }
public Student addNewStudent(Student student) { for (Student s : this.students) { if (s.getFirstName().equals(student.getFirstName()) && s.getLastName().equals(student.getLastName()) && s.getId() == student.getId()) { return null; } } this.students.add(student); return student; }