Class BooleanBinarySearch
java.lang.Object
org.magicwerk.brownies.collections.helper.primitive.BooleanBinarySearch
Binary search for primitive type boolean.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
binarySearch
(IBooleanList list, boolean key, int lower, int upper) Searches the specified list for the specified object using the binary search algorithm.
-
Constructor Details
-
BooleanBinarySearch
public BooleanBinarySearch()
-
-
Method Details
-
binarySearch
Searches the specified list for the specified object using the binary search algorithm. The list must be sorted into ascending order according to the specified comparator (as by theCollections.sort(List, Comparator)
method), prior to making this call. If it is not sorted, the results are undefined.This method runs in log(n) time on random-access lists, which offer near-constant-time access to each list element.
- Parameters:
list
- the list to be searched.key
- the value to be searched for.lower
- lower bound of range to searchupper
- upper bound of range to search- Returns:
- the index of the search key, if it is contained in the list; otherwise, (-(insertion point) - 1).
-