public boolean containsValue(Object value) {
        if (value == null)
            throw new NullPointerException();

        // See explanation of modCount use above

        final Segment<K,V>[] segments = this.segments;
        int[] mc = new int[segments.length];

        // Try a few times without locking
        for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) {
            int mcsum = 0;
            for (int i = 0; i < segments.length; ++i) {
                mcsum += mc[i] = segments[i].modCount;
                if (segments[i].containsValue(value))
                    return true;
            }
            boolean cleanSweep = true;
            if (mcsum != 0) {
                for (int i = 0; i < segments.length; ++i) {
                    if (mc[i] != segments[i].modCount) {
                        cleanSweep = false;
                        break;
                    }
                }
            }
            if (cleanSweep)
                return false;
        }
        // Resort to locking all segments
        for (int i = 0; i < segments.length; ++i)
            segments[i].lock();
        boolean found = false;
        try {
            for (int i = 0; i < segments.length; ++i) {
                if (segments[i].containsValue(value)) {
                    found = true;
                    break;
                }
            }
        } finally {
            for (int i = 0; i < segments.length; ++i)
                segments[i].unlock();
        }
        return found;
    }
public boolean containsValue ( Object value ) { if ( value == null ) throw new NullPointerException ( ) ; final Segment < K , V > [ ] segments = this . segments ; int [ ] mc = new int [ segments . length ] ; for ( int k = 0 ; k < RETRIES_BEFORE_LOCK ; ++ k ) { int mcsum = 0 ; for ( int i = 0 ; i < segments . length ; ++ i ) { mcsum += mc [ i ] = segments [ i ] . modCount ; if ( segments [ i ] . containsValue ( value ) ) return true ; } boolean cleanSweep = true ; if ( mcsum != 0 ) { for ( int i = 0 ; i < segments . length ; ++ i ) { if ( mc [ i ] != segments [ i ] . modCount ) { cleanSweep = false ; break ; } } } if ( cleanSweep ) return false ; } for ( int i = 0 ; i < segments . length ; ++ i ) segments [ i ] . lock ( ) ; boolean found = false ; try { for ( int i = 0 ; i < segments . length ; ++ i ) { if ( segments [ i ] . containsValue ( value ) ) { found = true ; break ; } } } finally { for ( int i = 0 ; i < segments . length ; ++ i ) segments [ i ] . unlock ( ) ; } return found ; }
Returns <tt>true</tt> if this map maps one or more keys to the
specified value. Note: This method requires a full internal
traversal of the hash table, and so is much slower than
method <tt>containsKey</tt>.

@param value value whose presence in this map is to be tested
@return <tt>true</tt> if this map maps one or more keys to the
specified value
@throws NullPointerException if the specified value is null