linkedList

package module
v0.0.0-...-e2e8332 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 2 Imported by: 0

README

linkedList

Generic linked list implemented for golang

Caution for go1.22

When building your project, use GOEXPERIMENT=rangefunc go build

Documentation

Index

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
}

func FromSlice

func FromSlice[T any](slice []T) *List[T]

func New

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

func (*List[T]) All

func (l *List[T]) All() iter.Seq2[int, T]

func (*List[T]) Append

func (l *List[T]) Append(data T)

func (*List[T]) AppendAfter

func (l *List[T]) AppendAfter(data T, node *Node[T])

func (*List[T]) AppendAt

func (l *List[T]) AppendAt(data T, index int) error

func (*List[T]) AppendBefore

func (l *List[T]) AppendBefore(data T, node *Node[T])

func (*List[T]) AppendSlice

func (l *List[T]) AppendSlice(slice []T)

func (*List[T]) AppendSliceAt

func (l *List[T]) AppendSliceAt(slice []T, index int) error

func (*List[T]) Backward

func (l *List[T]) Backward() iter.Seq2[int, T]

func (*List[T]) DeleteFunc

func (l *List[T]) DeleteFunc(data T, eq func(a, b T) bool) error

func (*List[T]) DeleteIndex

func (l *List[T]) DeleteIndex(index int) error

func (*List[T]) DeleteNode

func (l *List[T]) DeleteNode(node *Node[T])

func (*List[T]) Get

func (l *List[T]) Get(index int) (T, error)

func (*List[T]) Head

func (l *List[T]) Head() *Node[T]

func (*List[T]) IndexFunc

func (l *List[T]) IndexFunc(data T, eq func(T, T) bool) (int, error)

func (*List[T]) Set

func (l *List[T]) Set(data T, index int) error

func (*List[T]) Size

func (l *List[T]) Size() int

func (*List[T]) SortFunc

func (l *List[T]) SortFunc(cmp func(a, b T) int)

func (*List[T]) Tail

func (l *List[T]) Tail() *Node[T]

func (*List[T]) ToSlice

func (l *List[T]) ToSlice() []T

type Node

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

func (*Node[T]) Get

func (n *Node[T]) Get() T

func (*Node[T]) Next

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

func (*Node[T]) Prev

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

func (*Node[T]) Set

func (n *Node[T]) Set(data T)

Jump to

Keyboard shortcuts

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