private V removeNullEntry() { containsNullKey = false; final V oldValue = value[n]; value[n] = null; size--; if (n > minN && size < maxFill / 4 && n > DEFAULT_INITIAL_SIZE) rehash(n / 2); return oldValue; } @Override
private void ensureCapacity(final int capacity) { final int needed = arraySize(capacity, f); if (needed > n) rehash(needed); } private void tryCapacity(final long capacity) {
private V removeEntry(final int pos) { final V oldValue = value[pos]; value[pos] = null; size--; shiftKeys(pos); if (n > minN && size < maxFill / 4 && n > DEFAULT_INITIAL_SIZE) rehash(n / 2); return oldValue; } private V removeNullEntry() {
private void tryCapacity(final long capacity) { final int needed = (int) Math.min(1 << 30, Math.max(2, HashCommon.nextPowerOfTwo((long) Math.ceil(capacity / f)))); if (needed > n) rehash(needed); } private V removeEntry(final int pos) {
private void insert(final int pos, final byte k, final V v) { if (pos == n) containsNullKey = true; key[pos] = k; value[pos] = v; if (size++ >= maxFill) rehash(arraySize(size + 1, f)); if (ASSERTS) checkTable(); } @Override
return true; try { rehash(l); } catch (OutOfMemoryError cantDoIt) { return false;
/** * Rehashes the map, making the table as small as possible. * * <p> * This method rehashes the table to the smallest size satisfying the load * factor. It can be used when the set will not be changed anymore, so to * optimize access speed and size. * * <p> * If the table size is already the minimum possible, this method does nothing. * * @return true if there was enough memory to trim the map. * @see #trim(int) */ public boolean trim() { final int l = arraySize(size, f); if (l >= n || size > maxFill(l, f)) return true; try { rehash(l); } catch (OutOfMemoryError cantDoIt) { return false; } return true; } /**