list

package
v0.0.0-...-940ab64 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

type List[V any] struct {
	Head, Tail *Node[V]
	// contains filtered or unexported fields
}

List is double linked list

func New

func New[V any]() *List[V]

New retruns a new an empty list

func (*List[V]) Len

func (l *List[V]) Len() int

Len returns length of List

func (*List[V]) PushHead

func (l *List[V]) PushHead(v V)

PushHead push value of element into the head of list

func (*List[V]) PushHeadNode

func (l *List[V]) PushHeadNode(n *Node[V])

PushHeadNode push element into the head of list

func (*List[V]) PushTail

func (l *List[V]) PushTail(v V)

PushTail push value of element into the tail of list

func (*List[V]) PushTailNode

func (l *List[V]) PushTailNode(n *Node[V])

PushTailNode push element into the tail of list

func (*List[V]) Remove

func (l *List[V]) Remove(n *Node[V])

Remove n form list

func (*List[V]) String

func (l *List[V]) String() (str string)

String returns a string with all the message of list, you can print it out to know all about the list.

type Node

type Node[V any] struct {
	Value      V
	Prev, Next *Node[V]
}

Node of list

func (*Node[V]) Each

func (n *Node[V]) Each(fn func(val V))

Each calls `fn` on each Node from n onward in the list

func (*Node[V]) ReverseEach

func (n *Node[V]) ReverseEach(fn func(val V))

ReverseEach calls `fn` on each Node from n backward in the list

Jump to

Keyboard shortcuts

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