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)
| 1158 | * {@code false} otherwise. |
| 1159 | */ |
| 1160 | @Override |
| 1161 | public boolean containsValue(Object value) { |
| 1162 | if (root == null) { |
| 1163 | return false; |
| 1164 | } |
| 1165 | Node<K, V> node = minimum(root); |
| 1166 | if (value != null) { |
| 1167 | while (node != null) { |
| 1168 | int to = node.right_idx; |
| 1169 | V[] values = node.values; |
| 1170 | for (int i = node.left_idx; i <= to; i++) { |
| 1171 | if (value.equals(values[i])) { |
| 1172 | return true; |
| 1173 | } |
| 1174 | } |
| 1175 | node = node.next; |
| 1176 | } |
| 1177 | } else { |
| 1178 | while (node != null) { |
| 1179 | int to = node.right_idx; |
| 1180 | V[] values = node.values; |
| 1181 | for (int i = node.left_idx; i <= to; i++) { |
| 1182 | if (values[i] == null) { |
| 1183 | return true; |
| 1184 | } |
| 1185 | } |
| 1186 | node = node.next; |
| 1187 | } |
| 1188 | } |
| 1189 | return false; |
| 1190 | } |
| 1191 | |
| 1192 | /** |
| 1193 | * Returns a set containing all of the mappings in this map. Each mapping is |