moveToTheFront method

void moveToTheFront(
  1. T item
)

Moves the first occurrence of the item to the start of the list.

Implementation

void moveToTheFront(T item) {
  final int pos = indexOf(item);
  if (pos != -1 && pos != 0) {
    removeAt(pos);
    insert(0, item);
  }
}