insertBy method

Iterable<T> insertBy(
  1. Order<T> order,
  2. T element

Insert element into the list at the first position where it is less than or equal to the next element based on order.

Note: The element is added before an equal element already in the Iterable.


Iterable<T> insertBy(Order<T> order, T element) => isEmpty
    ? [element]
    :, first) > 0
        ? [first, ...drop(1).insertBy(order, element)]
        : [element, first, ...drop(1)];