A basic chat program I wrote has several key words that generate special actions, images, messages, etc. I store all of the key words and special functions in a HashMap. Key wor
A better pattern here might be:
Value val = hashMap.get(user.getInput()); if (val != null) { doVal(); } else { // handle normal, non-keyword/specfial function }
which takes advantage of the fact that HashMap returns null if the key isn't contained in the Map.
null