@SuppressWarnings("unchecked") protected boolean removeMapping(Object o) { freePendingTables(); if (!(o instanceof Entry<?, ?>)) { return false; } Entry<K, V> e = (Entry<K, V>) o; Object key = e.getKey(); int hash = key.hashCode(); hashtable.position(indexFor(spread(hash))); for (int i = 0; i < reprobeLimit(); i++) { if (!hashtable.hasRemaining()) { hashtable.rewind(); } IntBuffer entry = (IntBuffer) hashtable.slice().limit(ENTRY_SIZE); if (isTerminating(entry)) { return false; } else if (isPresent(entry) && keyEquals(key, hash, readLong(entry, ENCODING), entry.get(KEY_HASHCODE)) && storageEngine.equalsValue(e.getValue(), readLong(entry, ENCODING))) { storageEngine.freeMapping(readLong(entry, ENCODING), entry.get(KEY_HASHCODE), true); entry.put(STATUS_REMOVED); slotRemoved(entry); shrink(); return true; } else { hashtable.position(hashtable.position() + ENTRY_SIZE); } } return false; }
@SuppressWarnings("unchecked") protected boolean removeMapping(Object o) { freePendingTables(); if (!(o instanceof Entry<?, ?>)) { return false; } Entry<K, V> e = (Entry<K, V>) o; Object key = e.getKey(); int hash = key.hashCode(); hashtable.position(indexFor(spread(hash))); for (int i = 0; i < reprobeLimit(); i++) { if (!hashtable.hasRemaining()) { hashtable.rewind(); } IntBuffer entry = (IntBuffer) hashtable.slice().limit(ENTRY_SIZE); if (isTerminating(entry)) { return false; } else if (isPresent(entry) && keyEquals(key, hash, readLong(entry, ENCODING), entry.get(KEY_HASHCODE)) && storageEngine.equalsValue(e.getValue(), readLong(entry, ENCODING))) { storageEngine.freeMapping(readLong(entry, ENCODING), entry.get(KEY_HASHCODE), true); entry.put(STATUS, STATUS_REMOVED); slotRemoved(entry); shrink(); return true; } else { hashtable.position(hashtable.position() + ENTRY_SIZE); } } return false; }