From 4a8ebd9166f448b7cc01ad961c715b59333bf027 Mon Sep 17 00:00:00 2001 From: Max Gerbeth Date: Wed, 11 Jan 2023 09:57:11 +0100 Subject: [PATCH] refactoring: printArrayList() in Shop.java --- src/main/java/org/bitbiome/shop/Shop.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bitbiome/shop/Shop.java b/src/main/java/org/bitbiome/shop/Shop.java index 20bff8a..d47a2a3 100644 --- a/src/main/java/org/bitbiome/shop/Shop.java +++ b/src/main/java/org/bitbiome/shop/Shop.java @@ -58,7 +58,9 @@ public class Shop { private void printArrayList(ArrayList arrayList){ System.out.println(""); for(int i = 0; i < arrayList.size(); i++){ - System.out.println(arrayList.get(i).getName() + " | Anzahl: " + arrayList.get(i).getAmount() + " | Kosten: " + arrayList.get(i).getGold()); + if(arrayList.get(i).getAmount() != 0) { + System.out.println(arrayList.get(i).getName() + " | Anzahl: " + arrayList.get(i).getAmount() + " | Kosten: " + arrayList.get(i).getGold()); + } } System.out.println(""); }