Interface BinarySearch.IntSearchTarget

Enclosing class:
BinarySearch
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface BinarySearch.IntSearchTarget
Represents the search target that can be found through bisecting the integer domain.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    locate(int low, int mid, int high)
    Given a range of [low..high] inclusively with mid as the middle point of the binary search, locates the target.
  • Method Details

    • locate

      int locate(int low, int mid, int high)
      Given a range of [low..high] inclusively with mid as the middle point of the binary search, locates the target.

      Returns 0 if mid is the target; negative to find it in the lower range of [low..mid); or positive to find it in the upper range of (mid..high].

      It's guaranteed that low <= mid <= high.