int via the intRange() methodlong via the longRange() methodobjRange() methodfind() methods that perform variations on the binary search.
from argument) for which it returns true.
If no value satisfies the predicate, the highest value (that is, the value given for the to argument) is returned.
The value returned by each find() method is always within the range [from, to].
In order to be well-defined, the predicate must be continuous, which is to say that
given some value n,
the predicate must return false for all < n and true for all >= n
when from ≤ n ≤ to.
If this constraint does not hold, then the results of the search will not be well-defined.
The behavior of the predicate outside of this range does not affect the well-definedness of the search operation.
to is numerically lower than from.
While such searches are well-defined, it should be noted that the from bound
remains inclusive while the to bound remains exclusive,
which might be surprising in some circumstances.
| Modifier and Type | Class and Description |
|---|---|
| private static interface | |
| public static class | BinarySearch.
Search operations which apply over an |
| private static interface | |
| public static class | BinarySearch.
Search operations which apply over an |
| private static interface | |
| public static class | BinarySearch.
Binary searches over a range of objects. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static < the array element type E> E | Returns: the array value at the indexthe array (must not be array, int null)the array index index)A getter function which can satisfy |
| public static BinarySearch. | Returns: an object which can perform binary searches over an integer range (notnull)Returns an object which can perform binary searches over an integer range (not |
| public static BinarySearch. | Returns: an object which can perform binary searches over a long integer range (notnull)Returns an object which can perform binary searches over a long integer range (not |
| public static BinarySearch. | Returns: an object which can perform binary searches over an object range (notnull)Returns an object which can perform binary searches over an object range (not |
| private static <A, B, C, D> int | searchInt(int from, int to, A a, B b, C c, D d, IntBinaryOperator midpoint, BinarySearch.
|
| private static <A, B, C, D> long | searchLong(long from, long to, A a, B b, C c, D d, LongBinaryOperator midpoint, BinarySearch.
|
| private static <T, A, B, C, D> T | searchObject(T from, T to, A a, B b, C c, D d, BinaryOperator<T> midpoint, BinarySearch.
|
| private static int | |
| private static long | |
| private static int | |
| private static long |