Documentation
¶
Overview ¶
Package list implements a doubly-linked list.
Index ¶
- type List
- func (lst *List[T]) Back() *Node[T]
- func (lst *List[T]) Front() *Node[T]
- func (lst *List[T]) InsertAfter(node *Node[T], val T) *Node[T]
- func (lst *List[T]) InsertBack(val T)
- func (lst *List[T]) InsertBefore(node *Node[T], val T) *Node[T]
- func (lst *List[T]) InsertFront(val T)
- func (lst *List[T]) Len() int
- func (lst *List[T]) Next(node *Node[T]) *Node[T]
- func (lst *List[T]) Nodes() iter.Seq[*Node[T]]
- func (lst *List[T]) Prev(node *Node[T]) *Node[T]
- func (lst *List[T]) Remove(node *Node[T])
- func (lst *List[T]) Values() iter.Seq[T]
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type List ¶
type List[T any] struct { // contains filtered or unexported fields }
List is a doubly-linked list. Create new lists with New and then use the list's methods to interact with it.
func (*List[T]) InsertAfter ¶
InsertAfter inserts a new node with the given value after `node`.
func (*List[T]) InsertBack ¶
func (lst *List[T]) InsertBack(val T)
InsertBack inserts a new node with the given value at the back of the list.
func (*List[T]) InsertBefore ¶
InsertBefore inserts a new node with the given value before `node`.
func (*List[T]) InsertFront ¶
func (lst *List[T]) InsertFront(val T)
InsertFront inserts a new node with the given value at the front of the list.
Click to show internal directories.
Click to hide internal directories.