so i am learning how to use the HashMap object. My question is, if I use the scanner object to ask a user for a String and I save that to a String variable. How can I take that String and "compare" it to my HashMap.
For example if a user inputs "abc".
My HashMap has ("a","abra") ("b","blastoise") ("c","charizard")
I want to print to System.out.println the result -- abra blastoise charizard instead of abc.
I will share my code that i have now but i am stuck with the next step and i hope that i am being clear with my question.
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String keyboard = "";
HashMap hm = new HashMap();
hm.put("A","Abra");
hm.put("B", "Blastoise");
hm.put("C", "Charizard");
hm.put("D", "Dewgong");
keyboard = sc.nextLine();
Thank you in advanced :)