(K key)
| 4213 | } |
| 4214 | |
| 4215 | Node<K, V> findNode(K key) { |
| 4216 | java.lang.Comparable<K> object = comparator == null ? toComparable((K) key) |
| 4217 | : null; |
| 4218 | K keyK = (K) key; |
| 4219 | Node<K, V> node = root; |
| 4220 | while (node != null) { |
| 4221 | K[] keys = node.keys; |
| 4222 | int left_idx = node.left_idx; |
| 4223 | int result = cmp(object, keyK, keys[left_idx]); |
| 4224 | if (result < 0) { |
| 4225 | node = node.left; |
| 4226 | } else if (result == 0) { |
| 4227 | return node; |
| 4228 | } else { |
| 4229 | int right_idx = node.right_idx; |
| 4230 | if (left_idx != right_idx) { |
| 4231 | result = cmp(object, keyK, keys[right_idx]); |
| 4232 | } |
| 4233 | if (result > 0) { |
| 4234 | node = node.right; |
| 4235 | } else { |
| 4236 | return node; |
| 4237 | } |
| 4238 | } |
| 4239 | } |
| 4240 | return null; |
| 4241 | } |
| 4242 | |
| 4243 | /** |
| 4244 | * Returns the value of the mapping with the specified key. |
no test coverage detected