h2/src/main/org/h2/mvstore/MVMap.java
/**
     * Remove a key-value pair, if the key exists.
     *
     * @param key the key (may not be null)
     * @return the old value if the key existed, or null otherwise
     */
Remove a key-value pair, if the key exists.
@param key the key (may not be null)
@return the old value if the key existed, or null otherwise
Remove a key - value pair if the key exists . @param key the key ( may not be null ) @return the old value if the key existed or null otherwise
@Override
    public V remove(Object key) {
        beforeWrite();
        try {
            long v = writeVersion;
            Page p = copyOnWrite(root, v);
            @SuppressWarnings("unchecked")
            V result = (V) remove(p, v, key);
            if (!p.isLeaf() && p.getTotalCount() == 0) {
                p.removePage();
                p = Page.createEmpty(this,  p.getVersion());
            }
            newRoot(p);
            return result;
        } finally {
            afterWrite();
        }
    }
@ Override public V remove ( Object key ) { beforeWrite ( ) ; try { long v = writeVersion ; Page p = copyOnWrite ( root , v ) ; @ SuppressWarnings ( "unchecked" ) V result = ( V ) remove ( p , v , key ) ; if ( ! p . isLeaf ( ) && p . getTotalCount ( ) == 0 ) { p . removePage ( ) ; p = Page . createEmpty ( this , p . getVersion ( ) ) ; } newRoot ( p ) ; return result ; } finally { afterWrite ( ) ; } }
Remove a key-value pair, if the key exists.
Remove a key - value pair if the key exists .