list

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: MulanPSL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element = list.Element

type List

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

func New

func New[T any](less func(T, T) bool) *List[T]

func (*List[T]) Back

func (x *List[T]) Back() T

func (*List[T]) Begin

func (x *List[T]) Begin() *Element

func (*List[T]) Erase

func (x *List[T]) Erase(e *Element) *Element

删除一个,返回下一个或者nil

func (*List[T]) Find

func (x *List[T]) Find(v T) *Element

func (*List[T]) FindBy

func (x *List[T]) FindBy(v T, start *Element) *Element

func (*List[T]) FindByFunc

func (x *List[T]) FindByFunc(v T, start *Element, eq func(T, T) bool) *Element

func (*List[T]) FindFunc

func (x *List[T]) FindFunc(v T, eq func(T, T) bool) *Element

func (*List[T]) Front

func (x *List[T]) Front() T

func (*List[T]) GetValue

func (x *List[T]) GetValue(e *Element) T

func (*List[T]) Index

func (x *List[T]) Index(i int) *Element

func (*List[T]) Index2

func (x *List[T]) Index2(i int, j int) (*Element, *Element)

func (*List[T]) InsertAfter

func (x *List[T]) InsertAfter(v T, mark *Element) *Element

InsertAfter inserts a new element e with value v immediately after mark and returns e. If mark is not an element of l, the list is not modified. The mark must not be nil.

func (*List[T]) InsertBefore

func (x *List[T]) InsertBefore(v T, mark *Element) *Element

InsertBefore inserts a new element e with value v immediately before mark and returns e. If mark is not an element of l, the list is not modified. The mark must not be nil.

func (*List[T]) Len

func (x *List[T]) Len() int

func (*List[T]) Less

func (x *List[T]) Less(i, j int) bool

func (*List[T]) MoveAfter

func (x *List[T]) MoveAfter(e, mark *Element)

MoveAfter moves element e to its new position after mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.

func (*List[T]) MoveBefore

func (x *List[T]) MoveBefore(e, mark *Element)

MoveBefore moves element e to its new position before mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.

func (*List[T]) MoveToBack

func (x *List[T]) MoveToBack(e *Element)

MoveToBack moves element e to the back of list l. If e is not an element of l, the list is not modified. The element must not be nil.

func (*List[T]) MoveToFront

func (x *List[T]) MoveToFront(e *Element)

MoveToFront moves element e to the front of list l. If e is not an element of l, the list is not modified. The element must not be nil.

func (*List[T]) PopBack

func (x *List[T]) PopBack() T

func (*List[T]) PopFront

func (x *List[T]) PopFront() T

func (*List[T]) PushBack

func (x *List[T]) PushBack(v T) *Element

PushBack inserts a new element e with value v at the back of list l and returns e.

func (*List[T]) PushBackList

func (x *List[T]) PushBackList(other *List[T])

PushBackList inserts a copy of another list at the back of list l. The lists l and other may be the same. They must not be nil.

func (*List[T]) PushBackMuch

func (x *List[T]) PushBackMuch(v ...T)

PushBack inserts a new element e with value v at the back of list l and returns e.

func (*List[T]) PushFront

func (x *List[T]) PushFront(v T) *Element

PushFront inserts a new element e with value v at the front of list l and returns e.

func (*List[T]) PushFrontList

func (x *List[T]) PushFrontList(other *List[T])

PushFrontList inserts a copy of another list at the front of list l. The lists l and other may be the same. They must not be nil.

func (*List[T]) PushFrontMuch

func (x *List[T]) PushFrontMuch(v ...T)

func (*List[T]) Remove

func (x *List[T]) Remove(v T) bool

func (*List[T]) RemoveAll

func (x *List[T]) RemoveAll(v T) int

func (*List[T]) RemoveAllFunc

func (x *List[T]) RemoveAllFunc(v T, eq func(T, T) bool) int

func (*List[T]) RemoveFunc

func (x *List[T]) RemoveFunc(v T, eq func(T, T) bool) bool

func (*List[T]) RemoveMuch

func (x *List[T]) RemoveMuch(v T, c int) int

func (*List[T]) RemoveMuchFunc

func (x *List[T]) RemoveMuchFunc(v T, c int, eq func(T, T) bool) int

func (*List[T]) ReverseBegin

func (x *List[T]) ReverseBegin() *Element

func (*List[T]) Sort

func (x *List[T]) Sort()

func (*List[T]) Swap

func (x *List[T]) Swap(i, j int)

Jump to

Keyboard shortcuts

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