github.com/Nigel2392/go-datastructures@v1.1.5/linkedlist/doublynodes.go (about)

     1  package linkedlist
     2  
     3  // A node in a doubly linked list.
     4  type DoublyNode[T any] struct {
     5  	value T
     6  	next  *DoublyNode[T]
     7  	prev  *DoublyNode[T]
     8  }
     9  
    10  // Returns the node's next pointer.
    11  func (n *DoublyNode[T]) Next() *DoublyNode[T] {
    12  	return n.next
    13  }
    14  
    15  // Returns the node's previous pointer.
    16  func (n *DoublyNode[T]) Prev() *DoublyNode[T] {
    17  	return n.prev
    18  }
    19  
    20  // Returns the node's value.
    21  func (n *DoublyNode[T]) Value() T {
    22  	return n.value
    23  }