11.) Hashmap: Access How to print meal price by index number instead of string name?

I’d like to be able to print out the price of “Naan Pizza” by entering its index number instead of its string name.

Nothing I’ve tried has succeeded. My hypothesis is that it’s failing because I’m trying to access the index number of the restaurant menu as though the menu were an ArrayList when it is in fact HashMap…

Do I need to encompass the HashMap within an ArrayList to do this?

Nested HashMap is one possibility that I found in my reading. Perhaps give some of the results in this SERP a read:

java nested hashmap

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.