swap method
- SList<
T> other
Exchanges the contents of this list with those of other.
Implementation
void swap(SList<T> other) {
final tempHead = _head;
final tempTail = _tail;
final tempLength = _length;
_head = other._head;
_tail = other._tail;
_length = other._length;
other._head = tempHead;
other._tail = tempTail;
other._length = tempLength;
}