h2/src/main/org/h2/mvstore/MVMap.java
/**
     * Add or replace a key-value pair.
     *
     * @param key the key (may not be null)
     * @param value the value (may not be null)
     * @return the old value if the key existed, or null otherwise
     */
Add or replace a key-value pair.
@param key the key (may not be null)
@param value the value (may not be null)
@return the old value if the key existed, or null otherwise
Add or replace a key - value pair . @param key the key ( may not be null ) @param value the value ( may not be null ) @return the old value if the key existed or null otherwise
@Override
    @SuppressWarnings("unchecked")
    public V put(K key, V value) {
        DataUtils.checkArgument(value != null, "The value may not be null");
        beforeWrite();
        try {
            long v = writeVersion;
            Page p = copyOnWrite(root, v);
            p = splitRootIfNeeded(p, v);
            Object result = put(p, v, key, value);
            newRoot(p);
            return (V) result;
        } finally {
            afterWrite();
        }
    }
@ Override @ SuppressWarnings ( "unchecked" ) public V put ( K key , V value ) { DataUtils . checkArgument ( value != null , "The value may not be null" ) ; beforeWrite ( ) ; try { long v = writeVersion ; Page p = copyOnWrite ( root , v ) ; p = splitRootIfNeeded ( p , v ) ; Object result = put ( p , v , key , value ) ; newRoot ( p ) ; return ( V ) result ; } finally { afterWrite ( ) ; } }
Add or replace a key-value pair.
Add or replace a key - value pair .