lowerBound method

int lowerBound(
  1. E element,
  2. [int compare(
    1. E,
    2. E

Returns the index where element should be in this sorted list.

Uses binary search to find the location of where element should be. This takes on the order of log(n) comparisons. The list must be sorted according to compare, otherwise the result is unspecified. If compare is omitted, it uses the natural order of the elements.

If element does not occur in this list, the returned index is the first index where inserting element would keep the list sorted.


int lowerBound(E element, [int Function(E, E)? compare]) =>
    algorithms.lowerBoundBy<E, E>(
        this, identity, compare ?? compareComparable, element);