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

     1  package linkedlist
     2  
     3  // A node in a singly linked list.
     4  type Node[T any] struct {
     5  	value T
     6  	next  *Node[T]
     7  }
     8  
     9  // Returns the node's next pointer.
    10  func (n *Node[T]) Next() *Node[T] {
    11  	return n.next
    12  }
    13  
    14  // Returns the node's value.
    15  func (n *Node[T]) Value() T {
    16  	return n.value
    17  }