本文整理汇总了Java中java.util.Map.Entry.hashCode方法的典型用法代码示例。如果您正苦于以下问题:Java Entry.hashCode方法的具体用法?Java Entry.hashCode怎么用?Java Entry.hashCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Map.Entry
的用法示例。
在下文中一共展示了Entry.hashCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hashCode
import java.util.Map.Entry; //导入方法依赖的package包/类
@Override
public int hashCode()
{
int hash = 0;
ConcurrentEntry<K,V>[] entries = _entries;
for (Entry<K,V> entry : entries)
{
hash += entry.hashCode();
}
return hash;
}
示例2: hashCode
import java.util.Map.Entry; //导入方法依赖的package包/类
@Override
public int hashCode() {
int result = 31 * size + dimensions;
for (Entry<K, V> entry : this) {
result = 31 * result + entry.hashCode();
}
return result;
}
示例3: hashCode
import java.util.Map.Entry; //导入方法依赖的package包/类
/**
* Returns the hash code value for this map. The hash code of a map is
* defined to be the sum of the hash codes of each entry in the map's
* {@code entrySet()} view. This ensures that {@code m1.equals(m2)}
* implies that {@code m1.hashCode()==m2.hashCode()} for any two maps
* {@code m1} and {@code m2}, as required by the general contract of
* {@link Object#hashCode}.
*
* @implSpec
* This implementation iterates over {@code entrySet()}, calling
* {@link Map.Entry#hashCode hashCode()} on each element (entry) in the
* set, and adding up the results.
*
* @return the hash code value for this map
* @see Map.Entry#hashCode()
* @see Object#equals(Object)
* @see Set#equals(Object)
*/
public int hashCode() {
int h = 0;
for (Entry<K, V> entry : entrySet())
h += entry.hashCode();
return h;
}