insortLeft method

void insortLeft (
  1. E element,
  2. {int compare(
    1. E,
    2. E
    ),
  3. int low,
  4. int high}
)

Inserts an element to a sorted list while keeping it sorted, assuming this list is already sorted.

If the element is already on this list, it is inserted in the leftmost possible position.

Optional parameters works the same as in bisectLeft.

Equivalent to: list.insert(list.bisectLeft(element), element)

Implementation

void insortLeft(E element, {int Function(E, E) compare, int low, int high}) {
  low = bisectLeft(element, compare: compare, low: low, high: high);
  insert(low, element);
}