private void clearStaleEntry(int index) { while (true) { K currentKey; do { if (index == 0) { index = keys.length - 1; } else { index--; } currentKey = keys[index]; } while (currentKey == null || currentKey == REMOVED); if (recentlyAccessed.get(index)) { recentlyAccessed.clear(index); } else { break; } } // Delete the entry ((Object[])keys)[index] = REMOVED; numEntries--; values[index] = null; }
@Override public V get(Object key) { if (key == null) { return null; } int index = find(key); if (countingAccesses) { recentlyAccessed.set(index); } return values[index]; }
@Override public BitSet clone() { return new BitSet(bits.clone()); }
@Override public void clear() { numEntries = 0; numSlotsUsed = 0; Arrays.fill(keys, null); Arrays.fill(values, null); if (countingAccesses) { recentlyAccessed.clear(); } }
@Override public BitSet clone() { return new BitSet(bits.clone()); }
@Override public void clear() { numEntries = 0; numSlotsUsed = 0; Arrays.fill(keys, null); Arrays.fill(values, null); if (countingAccesses) { recentlyAccessed.clear(); } }
private void clearStaleEntry(int index) { while (true) { long currentKey; do { if (index == 0) { index = keys.length - 1; } else { index--; } currentKey = keys[index]; } while (currentKey == NULL || currentKey == REMOVED); if (recentlyAccessed.get(index)) { recentlyAccessed.clear(index); } else { break; } } // Delete the entry keys[index] = REMOVED; numEntries--; values[index] = null; }
@Override public BitSet clone() { return new BitSet(bits.clone()); }
public void clear() { numEntries = 0; numSlotsUsed = 0; Arrays.fill(keys, NULL); Arrays.fill(values, null); if (countingAccesses) { recentlyAccessed.clear(); } }
public V get(long key) { if (key == NULL) { return null; } int index = find(key); if (countingAccesses) { recentlyAccessed.set(index); } return values[index]; }
private void clearStaleEntry(int index) { while (true) { K currentKey; do { if (index == 0) { index = keys.length - 1; } else { index--; } currentKey = keys[index]; } while (currentKey == null || currentKey == REMOVED); if (recentlyAccessed.get(index)) { recentlyAccessed.clear(index); } else { break; } } // Delete the entry ((Object[])keys)[index] = REMOVED; numEntries--; values[index] = null; }
private void rehash(int newHashSize) { K[] oldKeys = keys; V[] oldValues = values; numEntries = 0; numSlotsUsed = 0; if (countingAccesses) { recentlyAccessed = new BitSet(newHashSize); } keys = (K[]) new Object[newHashSize]; values = (V[]) new Object[newHashSize]; int length = oldKeys.length; for (int i = 0; i < length; i++) { K key = oldKeys[i]; if (key != null && key != REMOVED) { put(key, oldValues[i]); } } }
public void clear() { numEntries = 0; numSlotsUsed = 0; Arrays.fill(keys, NULL); Arrays.fill(values, null); if (countingAccesses) { recentlyAccessed.clear(); } }
@Override public V get(Object key) { if (key == null) { return null; } int index = find(key); if (countingAccesses) { recentlyAccessed.set(index); } return values[index]; }
private void clearStaleEntry(int index) { while (true) { long currentKey; do { if (index == 0) { index = keys.length - 1; } else { index--; } currentKey = keys[index]; } while (currentKey == NULL || currentKey == REMOVED); if (recentlyAccessed.get(index)) { recentlyAccessed.clear(index); } else { break; } } // Delete the entry keys[index] = REMOVED; numEntries--; values[index] = null; }