标签:
1 static class Entry<K,V> implements Map.Entry<K,V> { 2 final K key; 3 V value; 4 Entry<K,V> next; 5 final int hash; 6 7 /** 8 * Creates new entry. 9 */ 10 Entry(int h, K k, V v, Entry<K,V> n) { 11 value = v; 12 next = n; 13 key = k; 14 hash = h; 15 } 16 .... 17 public final boolean equals(Object o) { 18 if (!(o instanceof Map.Entry)) 19 return false; 20 Map.Entry e = (Map.Entry)o; 21 Object k1 = getKey(); 22 Object k2 = e.getKey(); 23 if (k1 == k2 || (k1 != null && k1.equals(k2))) { 24 Object v1 = getValue(); 25 Object v2 = e.getValue(); 26 if (v1 == v2 || (v1 != null && v1.equals(v2))) 27 return true; 28 } 29 return false; 30 } 31 32 public final int hashCode() { 33 return (key==null ? 0 : key.hashCode()) ^ 34 (value==null ? 0 : value.hashCode()); 35 } 36 ....
标签:
原文地址:http://www.cnblogs.com/sasuke-y/p/5664774.html