Package jodd.util

Class BinarySearchBase


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

      All Methods Instance Methods Abstract Methods Concrete Methods 
      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 java.lang.Object

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

      • BinarySearchBase

        public BinarySearchBase()
    • Method Detail

      • 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.