From 4f78ed1352441d3637da64d7352d041665e0cde1 Mon Sep 17 00:00:00 2001 From: bethrobson Date: Wed, 26 Aug 2020 12:21:37 -0700 Subject: [PATCH] simplified add() code --- .../designpatterns/iterator/dinermergercafe/CafeMenu.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/headfirst/designpatterns/iterator/dinermergercafe/CafeMenu.java b/src/headfirst/designpatterns/iterator/dinermergercafe/CafeMenu.java index ab390678..e3646cd8 100755 --- a/src/headfirst/designpatterns/iterator/dinermergercafe/CafeMenu.java +++ b/src/headfirst/designpatterns/iterator/dinermergercafe/CafeMenu.java @@ -21,7 +21,7 @@ public void addItem(String name, String description, boolean vegetarian, double price) { MenuItem menuItem = new MenuItem(name, description, vegetarian, price); - menuItems.put(menuItem.getName(), menuItem); + menuItems.put(name, menuItem); } public Map getItems() {