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)
| 3834 | * {@code false} otherwise. |
| 3835 | */ |
| 3836 | @Override |
| 3837 | public boolean containsValue(Object value) { |
| 3838 | if (root == null) { |
| 3839 | return false; |
| 3840 | } |
| 3841 | Node<K, V> node = minimum(root); |
| 3842 | if (value != null) { |
| 3843 | while (node != null) { |
| 3844 | int to = node.right_idx; |
| 3845 | V[] values = node.values; |
| 3846 | for (int i = node.left_idx; i <= to; i++) { |
| 3847 | if (value.equals(values[i])) { |
| 3848 | return true; |
| 3849 | } |
| 3850 | } |
| 3851 | node = node.next; |
| 3852 | } |
| 3853 | } else { |
| 3854 | while (node != null) { |
| 3855 | int to = node.right_idx; |
| 3856 | V[] values = node.values; |
| 3857 | for (int i = node.left_idx; i <= to; i++) { |
| 3858 | if (values[i] == null) { |
| 3859 | return true; |
| 3860 | } |
| 3861 | } |
| 3862 | node = node.next; |
| 3863 | } |
| 3864 | } |
| 3865 | return false; |
| 3866 | } |
| 3867 | |
| 3868 | private boolean containsValue(Entry<K, V> node, Object value) { |
| 3869 | if (value == null ? node.value == null : value.equals(node.value)) { |