@Override public boolean containsKey(K key) { readCount++; return map.containsKey(key); }
@Override public boolean containsKey(K key) { return map.containsKey(key); }
/** * Generate a new key. * * @return the new key */ private long getAndIncrementNextKey() { long key = nextKey.getAndIncrement(); if (!map.containsKey(key)) { return key; } // search the next free id using binary search synchronized (this) { long low = key, high = Long.MAX_VALUE; while (low < high) { long x = (low + high) >>> 1; if (map.containsKey(x)) { low = x + 1; } else { high = x; } } key = low; nextKey.set(key + 1); return key; } }