13. Functional Programming with Lambda Expressions
Activity 1: Modifying Immutable Lists
Solution
- Write an application which modifies the ShoppingCart class found in Exercise 2 to allow for removing items from the cart.
        public ShoppingCart removeItem(ShoppingItem item) {            Map<String, Integer> newList = new HashMap<>(mShoppingList);             int value = 0;             if (newList.containsKey(item.name)) {                 value = newList.get(item.name);             }             if (value > 0) {       ...