dllist

package
v0.0.0-...-af5906d Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 0 Imported by: 2

Documentation

Overview

doubly linked list

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dllist

type Dllist[Item any] struct {
	// contains filtered or unexported fields
}

Dllist represents a doubly linked list.

func New

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

func (*Dllist[T]) Back

func (l *Dllist[T]) Back() *Element[T]

func (*Dllist[T]) Clear

func (l *Dllist[T]) Clear() *Dllist[T]

func (*Dllist[T]) Front

func (l *Dllist[T]) Front() *Element[T]

func (*Dllist[T]) Get

func (l *Dllist[T]) Get(i int) *Element[T]

func (*Dllist[T]) InsertAfter

func (l *Dllist[T]) InsertAfter(v T, mark *Element[T]) *Element[T]

func (*Dllist[T]) InsertBefore

func (l *Dllist[T]) InsertBefore(v T, mark *Element[T]) *Element[T]

func (*Dllist[T]) Len

func (l *Dllist[T]) Len() int

func (*Dllist[T]) MoveAfter

func (l *Dllist[T]) MoveAfter(e, mark *Element[T])

func (*Dllist[T]) MoveBefore

func (l *Dllist[T]) MoveBefore(e, mark *Element[T])

func (*Dllist[T]) MoveToBack

func (l *Dllist[T]) MoveToBack(e *Element[T])

func (*Dllist[T]) MoveToFront

func (l *Dllist[T]) MoveToFront(e *Element[T])

func (*Dllist[T]) PushBack

func (l *Dllist[T]) PushBack(v T) *Element[T]

func (*Dllist[T]) PushBackList

func (l *Dllist[T]) PushBackList(other *Dllist[T])

func (*Dllist[T]) PushBackListTo

func (l *Dllist[T]) PushBackListTo(other *Dllist[T], mark *Element[T])

func (*Dllist[T]) PushFront

func (l *Dllist[T]) PushFront(v T) *Element[T]

func (*Dllist[T]) PushFrontList

func (l *Dllist[T]) PushFrontList(other *Dllist[T])

func (*Dllist[T]) PushFrontListTo

func (l *Dllist[T]) PushFrontListTo(other *Dllist[T], mark *Element[T])

func (*Dllist[T]) Range

func (l *Dllist[T]) Range(f func(e *Element[T]) (Continue bool)) (RangeAll bool)

dont remove element when iterating, it will stop the iteration

func (*Dllist[T]) Remove

func (l *Dllist[T]) Remove(e *Element[T]) T

func (*Dllist[T]) Slice

func (l *Dllist[T]) Slice() []T

DeepClone returns a new Dllist with a copy of l's elements.

func (*Dllist[T]) Sort

func (l *Dllist[T]) Sort(cmpLess func(T, T) bool)

func (*Dllist[T]) Swap

func (l *Dllist[T]) Swap(a, b *Element[T])

type DllistConf

type DllistConf[Item any] func(*Dllist[Item])

type Element

type Element[Item any] struct {
	Value Item
	// contains filtered or unexported fields
}

func (*Element[T]) InsertAfter

func (e *Element[T]) InsertAfter(v T) *Element[T]

func (*Element[T]) InsertBefore

func (e *Element[T]) InsertBefore(v T) *Element[T]

func (*Element[T]) Next

func (e *Element[T]) Next() *Element[T]

func (*Element[T]) Prev

func (e *Element[T]) Prev() *Element[T]

func (*Element[T]) Range

func (e *Element[T]) Range(f func(e *Element[T]) (Continue bool))

dont remove element when iterating, it will stop the iteration

func (*Element[T]) Remove

func (e *Element[T]) Remove() T

Jump to

Keyboard shortcuts

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