From 6497f71223b4a16b382304575b473749ae1df42d Mon Sep 17 00:00:00 2001 From: TehZiHuai Date: Fri, 18 Oct 2019 16:28:07 +0800 Subject: [PATCH] ensured that adding tasks with priority will be immediately sorted --- src/main/java/Operations/TaskList.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/Operations/TaskList.java b/src/main/java/Operations/TaskList.java index 636611269b..ccce878bd6 100644 --- a/src/main/java/Operations/TaskList.java +++ b/src/main/java/Operations/TaskList.java @@ -33,6 +33,7 @@ public TaskList(ArrayList tasks) { */ public void add(Task newTask) { tasks.add(newTask); + sortPriority(); } /** @@ -64,6 +65,7 @@ public void delete(int[] index, TempDeleteList deletedList) throws RoomShareExce * Lists out all tasks in the current list in the order they were added into the list. */ public void list() throws RoomShareException { + sortPriority(); if( tasks.size() != 0 ){ int listCount = 1; for (Task output : tasks) {