Class DoubleBinarySearch

java.lang.Object
org.magicwerk.brownies.collections.helper.primitive.DoubleBinarySearch

public class DoubleBinarySearch extends Object
Binary search for primitive type double.
  • Constructor Details

    • DoubleBinarySearch

      public DoubleBinarySearch()
  • Method Details

    • binarySearch

      public static int binarySearch(IDoubleList list, double key, int lower, int upper)
      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 the Collections.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 search
      upper - upper bound of range to search
      Returns:
      the index of the search key, if it is contained in the list; otherwise, (-(insertion point) - 1).