src/main/java/com/stoyanr/evictor/map/ConcurrentMapWithTimedEvictionDecorator.java
/**
     * Removes the entry for a key only if currently mapped to a given value.
     * This is equivalent to
     * 
     * <pre>
     * if (map.containsKey(key) &amp;&amp; map.get(key).equals(value)) {
     *     map.remove(key);
     *     return true;
     * } else
     *     return false;
     * </pre>
     * 
     * except that the action is performed atomically.
     * 
     * @param key
     *            key with which the specified value is associated
     * 
     * @param value
     *            value expected to be associated with the specified key
     * 
     * @return <tt>true</tt> if the value was removed without being expired
     * 
     * @throws UnsupportedOperationException
     *             if the <tt>remove</tt> operation is not supported by the
     *             delegate map
     * 
     * @throws ClassCastException
     *             if the key or value is of an inappropriate type for this map
     * 
     * @throws NullPointerException
     *             if the specified key is null and the delegate map does not
     *             permit null keys, or if the specified value is null
     */
Removes the entry for a key only if currently mapped to a given value.
This is equivalent to



except that the action is performed atomically.

@param key
key with which the specified value is associated

@param value
value expected to be associated with the specified key

@return true if the value was removed without being expired

@throws UnsupportedOperationException
if the remove operation is not supported by the
delegate map

@throws ClassCastException
if the key or value is of an inappropriate type for this map

@throws NullPointerException
if the specified key is null and the delegate map does not
permit null keys, or if the specified value is null
Removes the entry for a key only if currently mapped to a given value . This is equivalent to except that the action is performed atomically . @param key key with which the specified value is associated @param value value expected to be associated with the specified key @return true if the value was removed without being expired @throws UnsupportedOperationException if the remove operation is not supported by the delegate map @throws ClassCastException if the key or value is of an inappropriate type for this map @throws NullPointerException if the specified key is null and the delegate map does not permit null keys or if the specified value is null
@Override
    public boolean remove(Object key, Object value) {
        if (value == null) {
            throw new NullPointerException("Value to be checked to cannot be null");
        }
        EvictibleEntry<K, V> oe = this.delegate.get(key);
        if ((oe == null) || evictIfExpired(oe) || !oe.getValue().equals(value)) {
            return false;
        }
        boolean removed = this.delegate.remove(key, oe);
        cancelEviction(oe);
        return removed;
    }
@ Override public boolean remove ( Object key , Object value ) { if ( value == null ) { throw new NullPointerException ( "Value to be checked to cannot be null" ) ; } EvictibleEntry < K , V > oe = this . delegate . get ( key ) ; if ( ( oe == null ) || evictIfExpired ( oe ) || ! oe . getValue ( ) . equals ( value ) ) { return false ; } boolean removed = this . delegate . remove ( key , oe ) ; cancelEviction ( oe ) ; return removed ; }
Removes the entry for a key only if currently mapped to a given value.
Removes the entry for a key only if currently mapped to a given value .
// An entry is being removed, cancel its automatic eviction