<p>The final implementation makes no guarantees about synchronization
or atomicity properties of this method. Any implementation providing
atomicity guarantees must override this method and document its
concurrency properties.
@param key key with which the specified value is associated
@param value value expected to be associated with the specified key
@return {@code true} if the value was removed
@throws UnsupportedOperationException if the {@code remove} operation
is not supported by this map
(<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
@throws ClassCastException if the key or value is of an inappropriate
type for this map
(<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
@throws NullPointerException if the specified key or value is null,
and this map does not permit null keys or values
(<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
Removes the entry for the specified key only if it is currently mapped to the specified value.
@implSpec The final implementation is equivalent to, for this {@code map}:
<pre> {@code if (map.containsKey(key) && Objects.equals(map.get(key), value)) { map.remove(key); return true; } else return false; }</pre>
<p>The final implementation makes no guarantees about synchronization or atomicity properties of this method. Any implementation providing atomicity guarantees must override this method and document its concurrency properties.
@param key key with which the specified value is associated @param value value expected to be associated with the specified key @return {@code true} if the value was removed @throws UnsupportedOperationException if the {@code remove} operation is not supported by this map (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>) @throws ClassCastException if the key or value is of an inappropriate type for this map (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>) @throws NullPointerException if the specified key or value is null, and this map does not permit null keys or values (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)