Question: Add a method called public Book get ( String key ) that retrieves an item given a key parameter from the HashMap. Make sure that

Add a method called public Book get(String key) that retrieves an item given a key parameter from the HashMap. Make sure that the key from the parameter is in the HashMap.
Add a method called public void remove(String key) that removes an item pairs given a key parameter from the HashMap. Make sure that the key from the parameter is in the HashMap.
Add a method called public void printAll(){..} that prints out all key and value pairs in the HashMap. Use an for-each loop.
Add a method called public void getBooksStartWithKey(String prefix)that prints
out all key and value pairs in the HashMap only if the title of the Book in the
HashMap start with the parameter prefix.
Test out all your methods in the main method. Create a new
Add a method called public Book get ( String key

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!