lowerBound<E> function Null safety

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.

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 sortedList.length if all the items in sortedList compare less than value.

Implementation

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