lowerBoundBy<K extends Comparable<K>> method Null safety

int lowerBoundBy<K extends Comparable<K>>(
  1. E element,
  2. K keyOf(
    1. E
    ),
  3. [int start = 0,
  4. int? end]
)

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

Uses binary search to find the location of element. The list must be sorted according to the natural ordering of the keyOf of the elements, 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.

If start and end are supplied, only that range is searched, and only that range need to be sorted.

Implementation

int lowerBoundBy<K extends Comparable<K>>(E element, K Function(E) keyOf,
        [int start = 0, int? end]) =>
    algorithms.lowerBoundBy<E, K>(
        this, keyOf, compareComparable, element, start, end);