static Map getAndClearMap(Map map) { if (map == null) ret emptyMap(); synchronized(collectionMutex(map)) { Map out = cloneMap(map); map.clear(); ret out; } }