protected boolean removeEldestEntry(Map.Entry<HashEntry<K, V>, V> eldest) { boolean aboveThreshold = isAboveThreshold(); if ( aboveThreshold ) { HashEntry<K, V> evictedEntry = eldest.getKey(); segment.evictionListener.onEntryChosenForEviction( evictedEntry.value ); segment.remove( evictedEntry.key, evictedEntry.hash, null ); evicted.add( evictedEntry ); } return aboveThreshold; }
/** * {@inheritDoc} * * @throws NullPointerException if the specified key is null */ @Override public boolean remove(Object key, Object value) { int hash = hash( key.hashCode() ); if ( value == null ) { return false; } return segmentFor( hash ).remove( key, hash, value ) != null; }
/** * Removes the key (and its corresponding value) from this map. * This method does nothing if the key is not in the map. * * @param key the key that needs to be removed * * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt> * * @throws NullPointerException if the specified key is null */ @Override public V remove(Object key) { int hash = hash( key.hashCode() ); return segmentFor( hash ).remove( key, hash, null ); }
/** * {@inheritDoc} * * @throws NullPointerException if the specified key is null */ @Override public boolean remove(Object key, Object value) { int hash = hash( key.hashCode() ); if ( value == null ) { return false; } return segmentFor( hash ).remove( key, hash, value ) != null; }
/** * Removes the key (and its corresponding value) from this map. * This method does nothing if the key is not in the map. * * @param key the key that needs to be removed * * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt> * * @throws NullPointerException if the specified key is null */ @Override public V remove(Object key) { int hash = hash( key.hashCode() ); return segmentFor( hash ).remove( key, hash, null ); }
private void removeFromSegment(Set<HashEntry<K, V>> evicted) { for ( HashEntry<K, V> e : evicted ) { ( (LIRSHashEntry<K, V>) e ).evict(); segment.evictionListener.onEntryChosenForEviction( e.value ); segment.remove( e.key, e.hash, null ); } }
protected boolean removeEldestEntry(Map.Entry<HashEntry<K, V>, V> eldest) { boolean aboveThreshold = isAboveThreshold(); if ( aboveThreshold ) { HashEntry<K, V> evictedEntry = eldest.getKey(); segment.evictionListener.onEntryChosenForEviction( evictedEntry.value ); segment.remove( evictedEntry.key, evictedEntry.hash, null ); evicted.add( evictedEntry ); } return aboveThreshold; }
private void removeFromSegment(Set<HashEntry<K, V>> evicted) { for ( HashEntry<K, V> e : evicted ) { ( (LIRSHashEntry<K, V>) e ).evict(); segment.evictionListener.onEntryChosenForEviction( e.value ); segment.remove( e.key, e.hash, null ); } }