From b98175dcc040d387deec3b1afd355210c42ec4e0 Mon Sep 17 00:00:00 2001 From: Gavzzz Date: Mon, 19 Sep 2022 13:27:48 +0800 Subject: [PATCH] Fixing level 8 branch issue and detect duplicates --- src/main/java/Duke/commands/DetectDuplicateCommands.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/Duke/commands/DetectDuplicateCommands.java b/src/main/java/Duke/commands/DetectDuplicateCommands.java index d6795031a2..57d3e3c467 100644 --- a/src/main/java/Duke/commands/DetectDuplicateCommands.java +++ b/src/main/java/Duke/commands/DetectDuplicateCommands.java @@ -23,7 +23,7 @@ public class DetectDuplicateCommands extends Command { public List execute(TaskList tasks, Ui ui, Storage storage) throws IOException, DukeException { int counter = 0; ArrayList text = new ArrayList<>(); - for (int i = 0; i < tasks.getTaskListSize(); i++) { + for (int i = 0; i < tasks.getTaskListSize() -1 ; i++) { for (int j = i + 1; j < tasks.getTaskListSize(); j++) { if (tasks.getTask(i) == tasks.getTask(j)) { text.add("There seems to be a duplicate task in your planner");