| 494 | } |
| 495 | |
| 496 | @Override |
| 497 | public synchronized int hashCode() { |
| 498 | int result = 0; |
| 499 | Iterator<Map.Entry<K, V>> it = entrySet().iterator(); |
| 500 | while (it.hasNext()) { |
| 501 | Map.Entry<K, V> entry = it.next(); |
| 502 | Object key = entry.getKey(); |
| 503 | if (key == this) { |
| 504 | continue; |
| 505 | } |
| 506 | Object value = entry.getValue(); |
| 507 | if (value == this) { |
| 508 | continue; |
| 509 | } |
| 510 | int hash = (key != null ? key.hashCode() : 0) |
| 511 | ^ (value != null ? value.hashCode() : 0); |
| 512 | result += hash; |
| 513 | } |
| 514 | return result; |
| 515 | } |
| 516 | |
| 517 | /** |
| 518 | * Returns true if this {@code Hashtable} has no key/value pairs. |