Returns whether this map contains the specified value. @param value the value to search for. @return true if this map contains the specified value, false otherwise.
(Object value)
| 376 | * {@code false} otherwise. |
| 377 | */ |
| 378 | @Override |
| 379 | public boolean containsValue(Object value) { |
| 380 | if (value != null) { |
| 381 | for (int i = 0; i < elementData.length; i++) { |
| 382 | Entry<K, V> entry = elementData[i]; |
| 383 | while (entry != null) { |
| 384 | if (areEqualKeys(value, entry.value)) { |
| 385 | return true; |
| 386 | } |
| 387 | entry = entry.next; |
| 388 | } |
| 389 | } |
| 390 | } else { |
| 391 | for (int i = 0; i < elementData.length; i++) { |
| 392 | Entry<K, V> entry = elementData[i]; |
| 393 | while (entry != null) { |
| 394 | if (entry.value == null) { |
| 395 | return true; |
| 396 | } |
| 397 | entry = entry.next; |
| 398 | } |
| 399 | } |
| 400 | } |
| 401 | return false; |
| 402 | } |
| 403 | |
| 404 | /** |
| 405 | * Returns a set containing all of the mappings in this map. Each mapping is |