Code example for Lock

Methods: lock, unlock

0
    // 
    // mutable operations 
    // 
 
    public final void clear() { 
        lock.lock();
        try { 
            set(copy(Collections.<K, V> emptyMap()));
        } finally { 
            lock.unlock();
        } 
    } 
 
    public final V remove(final Object key) {
        lock.lock();
        try { 
            // short circuit if key doesn't exist 
            if (!delegate.containsKey(key)) {
                return null; 
            } 
            final M map = copy();