Method
binarySearch
(final Trie[] children, final int nchildren, final String key)
Source from the content-addressed store, hash-verified
| 316 | } |
| 317 | |
| 318 | private static final int binarySearch(final Trie[] children, final int nchildren, final String key) { |
| 319 | int low = 0; |
| 320 | int high = nchildren-1; |
| 321 | |
| 322 | while (low <= high) { |
| 323 | int mid = (low + high) >> 1; |
| 324 | int c = children[mid].component.compareTo(key); |
| 325 | |
| 326 | if (c < 0) { |
| 327 | low = mid + 1; |
| 328 | } else if (c > 0) { |
| 329 | high = mid - 1; |
| 330 | } else { |
| 331 | return mid; |
| 332 | } |
| 333 | } |
| 334 | return -(low + 1); |
| 335 | } |
| 336 | |
| 337 | private static final class InternalIterator implements Iterator<String> { |
| 338 | private final Trie id; |
Tested by
no test coverage detected