Compares this Hashtable with the specified object and indicates if they are equal. In order to be equal, object must be an instance of Map and contain the same key/value pairs. @param object the object to compare with this object. @return true if the specified obj
(Object object)
| 473 | * @see #hashCode |
| 474 | */ |
| 475 | @Override |
| 476 | public synchronized boolean equals(Object object) { |
| 477 | if (this == object) { |
| 478 | return true; |
| 479 | } |
| 480 | if (object instanceof Map) { |
| 481 | Map<?, ?> map = (Map<?, ?>) object; |
| 482 | if (size() != map.size()) { |
| 483 | return false; |
| 484 | } |
| 485 | |
| 486 | Set<Map.Entry<K, V>> entries = entrySet(); |
| 487 | for (Map.Entry<?, ?> e : map.entrySet()) { |
| 488 | if (!entries.contains(e)) { |
| 489 | return false; |
| 490 | } |
| 491 | } |
| 492 | return true; |
| 493 | } |
| 494 | return false; |
| 495 | } |
| 496 | |
| 497 | /** |
| 498 | * Returns the value associated with the specified key in this |