diff --git a/src/main/java/seedu/address/ui/ScheduleListPanel.java b/src/main/java/seedu/address/ui/ScheduleListPanel.java index f9329673b66..dc85d9d6d55 100644 --- a/src/main/java/seedu/address/ui/ScheduleListPanel.java +++ b/src/main/java/seedu/address/ui/ScheduleListPanel.java @@ -33,11 +33,17 @@ public class ScheduleListPanel extends UiPart { public ScheduleListPanel(ObservableList studentList) { super(FXML); - scheduleListView.setItems(TransformList(studentList)); + scheduleListView.setItems(transformList(studentList)); scheduleListView.setCellFactory(listView -> new ScheduleListViewCell()); } - public ObservableList> TransformList(ObservableList studentList) { + /** + * Extracts lessons from studentList + * Adds the lessons together with student as a pair and sorts it + * @param studentList observable list of students + * @return an observable list of a pair of students and lessons + */ + public ObservableList> transformList(ObservableList studentList) { List> scheduleList = new ArrayList<>(); for (Student student : studentList) { List studentLesson = student.getLessons();