本文整理汇总了Java中com.sun.jmx.mbeanserver.Util.hashCode方法的典型用法代码示例。如果您正苦于以下问题:Java Util.hashCode方法的具体用法?Java Util.hashCode怎么用?Java Util.hashCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jmx.mbeanserver.Util
的用法示例。
在下文中一共展示了Util.hashCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hashCode
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
/**
* <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;
}
示例2: hashCode
import com.sun.jmx.mbeanserver.Util; //导入方法依赖的package包/类
/**
* <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]));
}