Class BinarySearchBase

java.lang.Object
jodd.util.BinarySearchBase

public abstract class BinarySearchBase extends Object
Abstract binary search. It is more abstract then BinarySearch.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract int
    compare(int index)
    Compares element at index position with the target.
    int
    find(int low, int high)
    Finds index of given element in inclusive index range.
    int
    findFirst(int low, int high)
    Finds very first index of given element in inclusive index range.
    int
    findLast(int low, int high)
    Finds very last index of given element in inclusive index range.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BinarySearchBase

      public BinarySearchBase()
  • Method Details

    • compare

      protected abstract int compare(int index)
      Compares element at index position with the target.
    • find

      public int find(int low, int high)
      Finds index of given element in inclusive index range. Returns negative value if element is not found.
    • findFirst

      public int findFirst(int low, int high)
      Finds very first index of given element in inclusive index range. Returns negative value if element is not found.
    • findLast

      public int findLast(int low, int high)
      Finds very last index of given element in inclusive index range. Returns negative value if element is not found.