map multiple keys to a single value?
807600Jun 25 2007 — edited Jun 26 2007Hi all,
I am reading "Objects first with Java"(third edition) and I am kind of stack on page 145.
I am given a little project called techsupport system which simply gets the user input from the terminal window, splits it at the spaces adds the words to a HashSet and passes it to another class which iterates trough the collection. During this each word is passed to a HashMap as a key and if a match is found it prints out the value.
My exercises are:
1. to match more than 1 word to a given response (with only one entry to the map);
2. to use 2 keys and get their mapped value only if both words present in the HashSet.
I can easily do them with conditional statements but I have no clue who to do them with a HashMap. I have been stack on this for 2 days now and would really appreciate your tips. thanks