lowerBound<E> function

int lowerBound<E>(
  1. List<E> sortedList,
  2. E value,
  3. {int compare(
    1. E,
    2. E

Returns the first position in sortedList that does not compare less than value.

Uses binary search to find the location of value. This takes on the order of log(n) comparisons. If the list isn't sorted according to the compare function, the result is unpredictable.

If compare is omitted, this defaults to calling Comparable.compareTo on the objects. In this case, the objects must be Comparable.

Returns the length of sortedList if all the items in sortedList compare less than value.


int lowerBound<E>(List<E> sortedList, E value, {int Function(E, E)? compare}) {
  compare ??= defaultCompare;
  return lowerBoundBy<E, E>(sortedList, identity, compare, value);