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)
| 433 | * @see #hashCode |
| 434 | */ |
| 435 | @Override |
| 436 | public synchronized boolean equals(Object object) { |
| 437 | if (this == object) { |
| 438 | return true; |
| 439 | } |
| 440 | if (object instanceof Map) { |
| 441 | Map<?, ?> map = (Map<?, ?>) object; |
| 442 | if (size() != map.size()) { |
| 443 | return false; |
| 444 | } |
| 445 | |
| 446 | Set<Map.Entry<K, V>> entries = entrySet(); |
| 447 | Iterator it = map.entrySet().iterator(); |
| 448 | while(it.hasNext()) { |
| 449 | Map.Entry<?, ?> e = (Map.Entry<?, ?>)it.next(); |
| 450 | if (!entries.contains(e)) { |
| 451 | return false; |
| 452 | } |
| 453 | } |
| 454 | return true; |
| 455 | } |
| 456 | return false; |
| 457 | } |
| 458 | |
| 459 | /** |
| 460 | * Returns the value associated with the specified key in this |