| 366 | /// |
| 367 | /// - #entrySet() |
| 368 | @Override |
| 369 | public boolean equals(Object object) { |
| 370 | if (this == object) { |
| 371 | return true; |
| 372 | } |
| 373 | if (object instanceof Map) { |
| 374 | Map<?, ?> map = (Map<?, ?>) object; |
| 375 | if (size() != map.size()) { |
| 376 | return false; |
| 377 | } |
| 378 | |
| 379 | try { |
| 380 | Iterator<Entry<K, V>> it = entrySet().iterator(); |
| 381 | while (it.hasNext()) { |
| 382 | Entry<K, V> entry = it.next(); |
| 383 | K key = entry.getKey(); |
| 384 | V mine = entry.getValue(); |
| 385 | Object theirs = map.get(key); |
| 386 | if (mine == null) { |
| 387 | if (theirs != null || !map.containsKey(key)) { |
| 388 | return false; |
| 389 | } |
| 390 | } else if (!mine.equals(theirs)) { |
| 391 | return false; |
| 392 | } |
| 393 | } |
| 394 | } catch (NullPointerException ignored) { |
| 395 | return false; |
| 396 | } catch (ClassCastException ignored) { |
| 397 | return false; |
| 398 | } |
| 399 | return true; |
| 400 | } |
| 401 | return false; |
| 402 | } |
| 403 | |
| 404 | /// Returns the value of the mapping with the specified key. |
| 405 | /// |