reverse method
Reverses the list in place (O(N) time complexity).
Implementation
void reverse() {
_DoubleListNode<T>? current = _head;
_DoubleListNode<T>? temp;
while (current != null) {
temp = current.prev;
current.prev = current.next;
current.next = temp;
current = current.prev; // Since we just swapped them
}
if (temp != null) {
_tail = _head;
_head = temp.prev;
}
}