static void syncPutIfNotThere(Map map, A key, B value) { if (map != null && key != null && value != null) synchronized(map) { if (!map.containsKey(key)) map.put(key, value); } }