Class SearchUtil


  • public class SearchUtil
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      SearchUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> int intBinarySearch​(SearchUtil.IntComparator comparator, int startIndex, int count)
      Method to search over any kind of sorted range.
      • Methods inherited from class java.lang.Object

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

      • SearchUtil

        public SearchUtil()
    • Method Detail

      • intBinarySearch

        public static <T> int intBinarySearch​(SearchUtil.IntComparator comparator,
                                              int startIndex,
                                              int count)
        Method to search over any kind of sorted range. The comparator is called with an int following the binary search algorithm until a match or the range is exhausted.
        Returns:
        the matching value or -1 if we exhausted the range.