@@ -140,6 +140,20 @@ func (d *DoublyLinkedList[V]) PushBefore(node *Node[V], v V) *Node[V] {
140140	return  newNode 
141141}
142142
143+ // InsertBefore inserts the supplied node before the supplied node. 
144+ // 
145+ // The supplied node must be attached to the current list otherwise undefined behaviour could occur. 
146+ func  (d  * DoublyLinkedList [V ]) InsertBefore (node  * Node [V ], inserting  * Node [V ]) {
147+ 	d .moveBefore (node , inserting )
148+ }
149+ 
150+ // InsertAfter inserts the supplied node after the supplied node. 
151+ // 
152+ // The supplied node must be attached to the current list otherwise undefined behaviour could occur. 
153+ func  (d  * DoublyLinkedList [V ]) InsertAfter (node  * Node [V ], inserting  * Node [V ]) {
154+ 	d .moveAfter (node , inserting )
155+ }
156+ 
143157// MoveBefore moves the `moving` node before the supplied `node`. 
144158// 
145159// The supplied `node` and `moving` nodes must be attached to the current list otherwise 
@@ -223,6 +237,13 @@ func (d *DoublyLinkedList[V]) MoveToFront(node *Node[V]) {
223237	d .pushFront (node )
224238}
225239
240+ // InsertAtFront pushes the provided node to the front/head. 
241+ // 
242+ // The supplied node must not be attached to any list otherwise undefined behaviour could occur. 
243+ func  (d  * DoublyLinkedList [V ]) InsertAtFront (node  * Node [V ]) {
244+ 	d .pushFront (node )
245+ }
246+ 
226247// MoveToBack moves the provided node to the end/tail. 
227248// 
228249// The supplied node must be attached to the current list otherwise undefined behaviour could occur. 
@@ -231,6 +252,13 @@ func (d *DoublyLinkedList[V]) MoveToBack(node *Node[V]) {
231252	d .pushBack (node )
232253}
233254
255+ // InsertAtBack pushes the provided node to the back/tail. 
256+ // 
257+ // The supplied node must not be attached to any list otherwise undefined behaviour could occur. 
258+ func  (d  * DoublyLinkedList [V ]) InsertAtBack (node  * Node [V ]) {
259+ 	d .pushBack (node )
260+ }
261+ 
234262// IsEmpty returns true if the list is empty. 
235263func  (d  * DoublyLinkedList [V ]) IsEmpty () bool  {
236264	return  d .len  ==  0 
0 commit comments