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 element. This takes on the order of log(n) comparisons. The list must be sorted according to compare, otherwise the result is unspecified.

If element is in the list, its index is returned, otherwise returns the first position where adding element would keep the list sorted. This may be the length of the list if all elements of the list compare less than element.

Implementation

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