whereMoveToTheEnd method

void whereMoveToTheEnd(
  1. bool test(
    1. T item
    )
)

Moves all items that satisfy the provided test to the end of the list. Keeps the relative order of the moved items.

Implementation

void whereMoveToTheEnd(bool Function(T item) test) {
  int compare(T f1, T f2) {
    bool test1 = test(f1);
    return (test1 == test(f2))
        ? 0
        : test1
            ? 1
            : -1;
  }

  sortOrdered(compare);
}