当前位置: 首页>>代码示例>>Java>>正文


Java Util.hashCode方法代码示例

本文整理汇总了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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:ImmutableDescriptor.java

示例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]));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:DescriptorSupport.java


注:本文中的com.sun.jmx.mbeanserver.Util.hashCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。