public void addFood(int shopId, String shopName, String image, Food food) { HashMap<Food, Integer> fs; if (!foods.containsKey(shopId)) { fs = new HashMap<Food, Integer>(); foods.put(shopId, fs); } else { fs = foods.get(shopId); } fs.put(food, food.getBuyCount()); if (shopName != null && !shopNames.containsKey(shopId)) { shopNames.put(shopId, shopName); } if (image != null && !shopImages.containsKey(shopId)) { shopImages.put(shopId, image); } }