insortRight method

void insortRight (
  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 rightmost possible position.

Optional parameters works the same as in bisectRight.

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

Implementation

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