HashMap examples: To check a product is available in the list or not.
Let us create this program using hashMap. A list of products with its prices are added to the hashMap. Steps: · Import the built-in packages java.util.HashMap,java.util.Map. · A public class is developed with main() function. · Constructor: initializes the object. · addItems() : it inserts the product and price. · getPrice() : This function gets the price for the product. · updatePrice(): it updates the price. · printPrice() : This function prints the product and price. Program: // import the built-in packages import java.util.HashMap; import java.util.Map; //Create a public class public class ProductPricesPrint { private Map<S...