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