Is it possible to have a HashMap return a default value for all keys that are not found in the set?
HashMap
Can't you just create a static method that does exactly this?
private static V getOrDefault(Map map, K key, V defaultValue) { return map.containsKey(key) ? map.get(key) : defaultValue; }