listext

package
v5.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2023 License: Apache-2.0, MIT Imports: 0 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoublyLinkedList

type DoublyLinkedList[V any] struct {
	// contains filtered or unexported fields
}

DoublyLinkedList is a doubly linked list

func NewDoublyLinked

func NewDoublyLinked[V any]() *DoublyLinkedList[V]

NewDoublyLinked creates a DoublyLinkedList for use.

func (*DoublyLinkedList[V]) Back

func (d *DoublyLinkedList[V]) Back() *Node[V]

Back returns the end/tail element for use without removing it or nil list is empty.

func (*DoublyLinkedList[V]) Clear

func (d *DoublyLinkedList[V]) Clear()

Clear removes all elements from the Linked List.

func (*DoublyLinkedList[V]) Front

func (d *DoublyLinkedList[V]) Front() *Node[V]

Front returns the front/head element for use without removing it or nil list is empty.

func (*DoublyLinkedList[V]) InsertAfter added in v5.13.0

func (d *DoublyLinkedList[V]) InsertAfter(node *Node[V], inserting *Node[V])

InsertAfter inserts the supplied node after the supplied node.

The supplied node must be attached to the current list otherwise undefined behaviour could occur.

func (*DoublyLinkedList[V]) InsertAtBack added in v5.13.0

func (d *DoublyLinkedList[V]) InsertAtBack(node *Node[V])

InsertAtBack pushes the provided node to the back/tail.

The supplied node must not be attached to any list otherwise undefined behaviour could occur.

func (*DoublyLinkedList[V]) InsertAtFront added in v5.13.0

func (d *DoublyLinkedList[V]) InsertAtFront(node *Node[V])

InsertAtFront pushes the provided node to the front/head.

The supplied node must not be attached to any list otherwise undefined behaviour could occur.

func (*DoublyLinkedList[V]) InsertBefore added in v5.13.0

func (d *DoublyLinkedList[V]) InsertBefore(node *Node[V], inserting *Node[V])

InsertBefore inserts the supplied node before the supplied node.

The supplied node must be attached to the current list otherwise undefined behaviour could occur.

func (*DoublyLinkedList[V]) IsEmpty

func (d *DoublyLinkedList[V]) IsEmpty() bool

IsEmpty returns true if the list is empty.

func (*DoublyLinkedList[V]) Len

func (d *DoublyLinkedList[V]) Len() int

Len returns length of the Linked List.

func (*DoublyLinkedList[V]) MoveAfter

func (d *DoublyLinkedList[V]) MoveAfter(node *Node[V], moving *Node[V])

MoveAfter moves the `moving` node after the supplied `node`.

The supplied `node` and `moving` nodes must be attached to the current list otherwise undefined behaviour could occur.

func (*DoublyLinkedList[V]) MoveBefore

func (d *DoublyLinkedList[V]) MoveBefore(node *Node[V], moving *Node[V])

MoveBefore moves the `moving` node before the supplied `node`.

The supplied `node` and `moving` nodes must be attached to the current list otherwise undefined behaviour could occur.

func (*DoublyLinkedList[V]) MoveToBack

func (d *DoublyLinkedList[V]) MoveToBack(node *Node[V])

MoveToBack moves the provided node to the end/tail.

The supplied node must be attached to the current list otherwise undefined behaviour could occur.

func (*DoublyLinkedList[V]) MoveToFront

func (d *DoublyLinkedList[V]) MoveToFront(node *Node[V])

MoveToFront moves the provided node to the front/head.

The supplied node must be attached to the current list otherwise undefined behaviour could occur.

func (*DoublyLinkedList[V]) PopBack

func (d *DoublyLinkedList[V]) PopBack() *Node[V]

PopBack removes the last element from a list and returns it or nil.

func (*DoublyLinkedList[V]) PopFront

func (d *DoublyLinkedList[V]) PopFront() *Node[V]

PopFront removes the first element and returns it or nil.

func (*DoublyLinkedList[V]) PushAfter

func (d *DoublyLinkedList[V]) PushAfter(node *Node[V], v V) *Node[V]

PushAfter pushes the supplied Value after the supplied node.

The supplied node must be attached to the current list otherwise undefined behaviour could occur.

func (*DoublyLinkedList[V]) PushBack

func (d *DoublyLinkedList[V]) PushBack(v V) *Node[V]

PushBack appends an element to the back of a list.

func (*DoublyLinkedList[V]) PushBefore

func (d *DoublyLinkedList[V]) PushBefore(node *Node[V], v V) *Node[V]

PushBefore pushes the supplied Value before the supplied node.

The supplied node must be attached to the current list otherwise undefined behaviour could occur.

func (*DoublyLinkedList[V]) PushFront

func (d *DoublyLinkedList[V]) PushFront(v V) *Node[V]

PushFront adds an element first in the list.

func (*DoublyLinkedList[V]) Remove

func (d *DoublyLinkedList[V]) Remove(node *Node[V])

Remove removes the provided element from the Linked List.

The supplied node must be attached to the current list otherwise undefined behaviour could occur.

type Node

type Node[V any] struct {
	Value V
	// contains filtered or unexported fields
}

Node is an element of the doubly linked list.

func (*Node[V]) Next

func (n *Node[V]) Next() *Node[V]

Next returns the nodes next Value or nil if it is at the tail.

func (*Node[V]) Prev

func (n *Node[V]) Prev() *Node[V]

Prev returns the nodes previous Value or nil if it is at the head.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL