Is checking for key existence in HashMap always necessary?
I have a HashMap with say a 1000 entries and I am looking at improving the efficiency. If the HashMap is b
I usually use the idiom
Object value = map.get(key); if (value == null) { value = createValue(key); map.put(key, value); }
This means you only hit the map twice if the key is missing