Documentation
¶
Overview ¶
Package list is a generic and thus type-safe version of golang's container/list. Wherever possible, it mimics the exact internal behavior as closely as possible.
Index ¶
- type Element
- type List
- func (l *List[E]) Back() *Element[E]
- func (l *List[E]) Front() *Element[E]
- func (l *List[E]) Init() *List[E]
- func (l *List[E]) InsertAfter(e E, mark *Element[E]) *Element[E]
- func (l *List[E]) InsertBefore(e E, mark *Element[E]) *Element[E]
- func (l *List[E]) Len() int
- func (l *List[E]) MoveAfter(e, mark *Element[E])
- func (l *List[E]) MoveBefore(e, mark *Element[E])
- func (l *List[E]) MoveToBack(e *Element[E])
- func (l *List[E]) MoveToFront(e *Element[E])
- func (l *List[E]) PushBack(e E) *Element[E]
- func (l *List[E]) PushBackList(other *List[E])
- func (l *List[E]) PushFront(e E) *Element[E]
- func (l *List[E]) PushFrontList(other *List[E])
- func (l *List[E]) Remove(e *Element[E]) E
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Element ¶
type Element[E any] struct { // Value is the value of the list Element. Value E // contains filtered or unexported fields }
Element is an element of a List.
type List ¶
type List[E any] struct { // contains filtered or unexported fields }
List is a doubly-linked list.
func (*List[E]) InsertAfter ¶
InsertAfter inserts the value after the Element used as mark, if the Element is part of the list.
func (*List[E]) InsertBefore ¶
InsertBefore inserts the value before the Element used as mark, if the Element is part of the list.
func (*List[E]) MoveAfter ¶
MoveAfter moves the Element after the marked element if it is part of the List.
func (*List[E]) MoveBefore ¶
MoveBefore moves the Element before the marked element if it is part of the List.
func (*List[E]) MoveToBack ¶
MoveToBack moves the Element to the back of the List if it is part of it.
func (*List[E]) MoveToFront ¶
MoveToFront moves the Element to the front of the List if it is part of it.
func (*List[E]) PushBack ¶
PushBack inserts the value at the back of the list, returning the created Element.
func (*List[E]) PushBackList ¶
PushBackList pushes all values of the other list to the back of this List.
func (*List[E]) PushFront ¶
PushFront inserts the value at the front of the list, returning the created Element.
func (*List[E]) PushFrontList ¶
PushFrontList pushes all values of the other list to the front of this List.