@@ -106,8 +106,8 @@ func (d *DoublyLinkedList[V]) PushAfter(node *Node[V], v V) *Node[V] {
106106
107107// MoveAfter moves the `moving` node after the supplied `node`.
108108//
109- // The supplied `node` must be attached to the current list and the `moving` node must either be attached to the
110- // current list or not attached to any other otherwise undefined behaviour could occur.
109+ // The supplied `node` and `moving` nodes must be attached to the current list otherwise
110+ // undefined behaviour could occur.
111111func (d * DoublyLinkedList [V ]) MoveAfter (node * Node [V ], moving * Node [V ]) {
112112 // first detach node were moving after, in case it was already attached somewhere else in the list.
113113 d .Remove (moving )
@@ -142,8 +142,8 @@ func (d *DoublyLinkedList[V]) PushBefore(node *Node[V], v V) *Node[V] {
142142
143143// MoveBefore moves the `moving` node before the supplied `node`.
144144//
145- // The supplied `node` must be attached to the current list and the `moving` node must either be attached to the
146- // current list or not attached to any other otherwise undefined behaviour could occur.
145+ // The supplied `node` and `moving` nodes must be attached to the current list otherwise
146+ // undefined behaviour could occur.
147147func (d * DoublyLinkedList [V ]) MoveBefore (node * Node [V ], moving * Node [V ]) {
148148 // first detach node were moving after, in case it was already attached somewhere else in the list.
149149 d .Remove (moving )
@@ -216,12 +216,16 @@ func (d *DoublyLinkedList[V]) Remove(node *Node[V]) {
216216}
217217
218218// MoveToFront moves the provided node to the front/head.
219+ //
220+ // The supplied node must be attached to the current list otherwise undefined behaviour could occur.
219221func (d * DoublyLinkedList [V ]) MoveToFront (node * Node [V ]) {
220222 d .Remove (node )
221223 d .pushFront (node )
222224}
223225
224226// MoveToBack moves the provided node to the end/tail.
227+ //
228+ // The supplied node must be attached to the current list otherwise undefined behaviour could occur.
225229func (d * DoublyLinkedList [V ]) MoveToBack (node * Node [V ]) {
226230 d .Remove (node )
227231 d .pushBack (node )
0 commit comments