Java Code Examples for com.sun.jmx.mbeanserver.Util#hashCode()

The following examples show how to use com.sun.jmx.mbeanserver.Util#hashCode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImmutableDescriptor.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link Arrays#deepHashCode(Object[])}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public int hashCode() {
    if (hashCode == -1) {
        hashCode = Util.hashCode(names, values);
    }
    return hashCode;
}
 
Example 2
Source File: ImmutableDescriptor.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link Arrays#deepHashCode(Object[])}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public int hashCode() {
    if (hashCode == -1) {
        hashCode = Util.hashCode(names, values);
    }
    return hashCode;
}
 
Example 3
Source File: ImmutableDescriptor.java    From Java8CN with Apache License 2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link Arrays#deepHashCode(Object[])}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public int hashCode() {
    if (hashCode == -1) {
        hashCode = Util.hashCode(names, values);
    }
    return hashCode;
}
 
Example 4
Source File: DescriptorSupport.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link java.util.Arrays#deepHashCode(Object[]) Arrays.deepHashCode}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public synchronized int hashCode() {
    final int size = descriptorMap.size();
    // descriptorMap is sorted with a comparator that ignores cases.
    //
    return Util.hashCode(
            descriptorMap.keySet().toArray(new String[size]),
            descriptorMap.values().toArray(new Object[size]));
}
 
Example 5
Source File: ImmutableDescriptor.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link Arrays#deepHashCode(Object[])}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public int hashCode() {
    if (hashCode == -1) {
        hashCode = Util.hashCode(names, values);
    }
    return hashCode;
}
 
Example 6
Source File: DescriptorSupport.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link java.util.Arrays#deepHashCode(Object[]) Arrays.deepHashCode}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public synchronized int hashCode() {
    final int size = descriptorMap.size();
    // descriptorMap is sorted with a comparator that ignores cases.
    //
    return Util.hashCode(
            descriptorMap.keySet().toArray(new String[size]),
            descriptorMap.values().toArray(new Object[size]));
}
 
Example 7
Source File: DescriptorSupport.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link java.util.Arrays#deepHashCode(Object[]) Arrays.deepHashCode}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public synchronized int hashCode() {
    final int size = descriptorMap.size();
    // descriptorMap is sorted with a comparator that ignores cases.
    //
    return Util.hashCode(
            descriptorMap.keySet().toArray(new String[size]),
            descriptorMap.values().toArray(new Object[size]));
}
 
Example 8
Source File: DescriptorSupport.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link java.util.Arrays#deepHashCode(Object[]) Arrays.deepHashCode}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public synchronized int hashCode() {
    final int size = descriptorMap.size();
    // descriptorMap is sorted with a comparator that ignores cases.
    //
    return Util.hashCode(
            descriptorMap.keySet().toArray(new String[size]),
            descriptorMap.values().toArray(new Object[size]));
}
 
Example 9
Source File: ImmutableDescriptor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link Arrays#deepHashCode(Object[])}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public int hashCode() {
    if (hashCode == -1) {
        hashCode = Util.hashCode(names, values);
    }
    return hashCode;
}
 
Example 10
Source File: DescriptorSupport.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link java.util.Arrays#deepHashCode(Object[]) Arrays.deepHashCode}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public synchronized int hashCode() {
    final int size = descriptorMap.size();
    // descriptorMap is sorted with a comparator that ignores cases.
    //
    return Util.hashCode(
            descriptorMap.keySet().toArray(new String[size]),
            descriptorMap.values().toArray(new Object[size]));
}
 
Example 11
Source File: DescriptorSupport.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link java.util.Arrays#deepHashCode(Object[]) Arrays.deepHashCode}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public synchronized int hashCode() {
    final int size = descriptorMap.size();
    // descriptorMap is sorted with a comparator that ignores cases.
    //
    return Util.hashCode(
            descriptorMap.keySet().toArray(new String[size]),
            descriptorMap.values().toArray(new Object[size]));
}
 
Example 12
Source File: DescriptorSupport.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link java.util.Arrays#deepHashCode(Object[]) Arrays.deepHashCode}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public synchronized int hashCode() {
    final int size = descriptorMap.size();
    // descriptorMap is sorted with a comparator that ignores cases.
    //
    return Util.hashCode(
            descriptorMap.keySet().toArray(new String[size]),
            descriptorMap.values().toArray(new Object[size]));
}
 
Example 13
Source File: ImmutableDescriptor.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link Arrays#deepHashCode(Object[])}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public int hashCode() {
    if (hashCode == -1) {
        hashCode = Util.hashCode(names, values);
    }
    return hashCode;
}
 
Example 14
Source File: ImmutableDescriptor.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link Arrays#deepHashCode(Object[])}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public int hashCode() {
    if (hashCode == -1) {
        hashCode = Util.hashCode(names, values);
    }
    return hashCode;
}
 
Example 15
Source File: DescriptorSupport.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link java.util.Arrays#deepHashCode(Object[]) Arrays.deepHashCode}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public synchronized int hashCode() {
    final int size = descriptorMap.size();
    // descriptorMap is sorted with a comparator that ignores cases.
    //
    return Util.hashCode(
            descriptorMap.keySet().toArray(new String[size]),
            descriptorMap.values().toArray(new Object[size]));
}
 
Example 16
Source File: DescriptorSupport.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link java.util.Arrays#deepHashCode(Object[]) Arrays.deepHashCode}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public synchronized int hashCode() {
    final int size = descriptorMap.size();
    // descriptorMap is sorted with a comparator that ignores cases.
    //
    return Util.hashCode(
            descriptorMap.keySet().toArray(new String[size]),
            descriptorMap.values().toArray(new Object[size]));
}
 
Example 17
Source File: ImmutableDescriptor.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link Arrays#deepHashCode(Object[])}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public int hashCode() {
    if (hashCode == -1) {
        hashCode = Util.hashCode(names, values);
    }
    return hashCode;
}
 
Example 18
Source File: DescriptorSupport.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link java.util.Arrays#deepHashCode(Object[]) Arrays.deepHashCode}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public synchronized int hashCode() {
    final int size = descriptorMap.size();
    // descriptorMap is sorted with a comparator that ignores cases.
    //
    return Util.hashCode(
            descriptorMap.keySet().toArray(new String[size]),
            descriptorMap.values().toArray(new Object[size]));
}
 
Example 19
Source File: ImmutableDescriptor.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link Arrays#deepHashCode(Object[])}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public int hashCode() {
    if (hashCode == -1) {
        hashCode = Util.hashCode(names, values);
    }
    return hashCode;
}
 
Example 20
Source File: DescriptorSupport.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * <p>Returns the hash code value for this descriptor.  The hash
 * code is computed as the sum of the hash codes for each field in
 * the descriptor.  The hash code of a field with name {@code n}
 * and value {@code v} is {@code n.toLowerCase().hashCode() ^ h}.
 * Here {@code h} is the hash code of {@code v}, computed as
 * follows:</p>
 *
 * <ul>
 * <li>If {@code v} is null then {@code h} is 0.</li>
 * <li>If {@code v} is a primitive array then {@code h} is computed using
 * the appropriate overloading of {@code java.util.Arrays.hashCode}.</li>
 * <li>If {@code v} is an object array then {@code h} is computed using
 * {@link java.util.Arrays#deepHashCode(Object[]) Arrays.deepHashCode}.</li>
 * <li>Otherwise {@code h} is {@code v.hashCode()}.</li>
 * </ul>
 *
 * @return A hash code value for this object.
 *
 */
// Note: this Javadoc is copied from javax.management.Descriptor
//       due to 6369229.
@Override
public synchronized int hashCode() {
    final int size = descriptorMap.size();
    // descriptorMap is sorted with a comparator that ignores cases.
    //
    return Util.hashCode(
            descriptorMap.keySet().toArray(new String[size]),
            descriptorMap.values().toArray(new Object[size]));
}