From 292f6bedad0d178ff02b53d45c873b5e5776d9fc Mon Sep 17 00:00:00 2001 From: PureUsagi Date: Tue, 12 Mar 2024 19:07:40 +0800 Subject: [PATCH] Simplify Delete method in ItemList. --- src/main/java/seedu/binbash/ItemList.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/seedu/binbash/ItemList.java b/src/main/java/seedu/binbash/ItemList.java index c0e44e9056..4e1cf42ffc 100644 --- a/src/main/java/seedu/binbash/ItemList.java +++ b/src/main/java/seedu/binbash/ItemList.java @@ -22,8 +22,7 @@ public void addItem(Item item) { } public String deleteItem(int index) { - Item tempItem = itemList.get(index - 1); - itemList.remove(index - 1); + Item tempItem = itemList.remove(index - 1); String output = "Got it! I've removed the following item:" + String.format("\t%s", tempItem);