Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LinkedList ¶
type LinkedList[T any] struct { // contains filtered or unexported fields }
LinkedList implements a pointer-linked list with a head and tail.
The empty value is a valid empty linked list.
func NewLinkedList ¶
func NewLinkedList[T any](elems ...T) *LinkedList[T]
NewLinkedList constructs a new LinkedList.
func (*LinkedList[T]) IsEmpty ¶
func (l *LinkedList[T]) IsEmpty() bool
IsEmpty checks if the linked list is empty.
func (*LinkedList[T]) Peek ¶
func (l *LinkedList[T]) Peek() (T, bool)
Peek peeks the head of the linked list.
func (*LinkedList[T]) PeekTail ¶
func (l *LinkedList[T]) PeekTail() (T, bool)
PeekTail peeks the tail of the linked list.
func (*LinkedList[T]) Pop ¶
func (l *LinkedList[T]) Pop() (T, bool)
Pop dequeues the head of the linked list.
func (*LinkedList[T]) Push ¶
func (l *LinkedList[T]) Push(val T)
Push pushes a value to the end of the linked list.
func (*LinkedList[T]) PushFront ¶
func (l *LinkedList[T]) PushFront(val T)
PushFront pushes a value to the front of the linked list. It will be returned next for Pop or Peek.
func (*LinkedList[T]) Reset ¶ added in v1.5.7
func (l *LinkedList[T]) Reset()
Reset clears the linked list.
Click to show internal directories.
Click to hide internal directories.