本文整理匯總了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;
}