bsearchLessThan method

int bsearchLessThan(
  1. E x, {
  2. Comparator<E>? compare,
})

Assuming the list is sorted, locate rightmost element less than x.

If the element is found, the index of element is returned. If not found, -1 is returned.

Implementation

int bsearchLessThan(E x, {Comparator<E>? compare}) {
  final i = this.bisectLeft(x, compare: compare);
  if (i != 0) {
    return i - 1;
  }
  return -1;
}