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)
| 85 | * {@code false} otherwise. |
| 86 | */ |
| 87 | public boolean containsValue(Object value) { |
| 88 | Iterator<Map.Entry<K, V>> it = entrySet().iterator(); |
| 89 | if (value != null) { |
| 90 | while (it.hasNext()) { |
| 91 | if (value.equals(it.next().getValue())) { |
| 92 | return true; |
| 93 | } |
| 94 | } |
| 95 | } else { |
| 96 | while (it.hasNext()) { |
| 97 | if (it.next().getValue() == null) { |
| 98 | return true; |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | return false; |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * Returns a set containing all of the mappings in this map. Each mapping is |