LLD - Design — Food Delivery System
Consider this Menu class snippet:
What will happen if addItem is called twice with the same dish name but different prices?
class Menu {
Map items = new HashMap<>();
void addItem(String name, double price) {
items.putIfAbsent(name, price);
}
} What will happen if addItem is called twice with the same dish name but different prices?
