Documentation ¶
Overview ¶
Package list implements a doubly linked list.
To iterate over a list (where l is a *List):
for e := l.Front(); e != nil; e = e.Next() { // do something with e.Value }
Index ¶
- type Element
- type List
- func (l *List) Back() *Element
- func (l *List) Front() *Element
- func (l *List) Init() *List
- func (l *List) InsertAfter(value interface{}, mark *Element) *Element
- func (l *List) InsertBefore(value interface{}, mark *Element) *Element
- func (l *List) Len() int
- func (l *List) MoveToBack(e *Element)
- func (l *List) MoveToFront(e *Element)
- func (l *List) PushBack(value interface{}) *Element
- func (l *List) PushBackList(ol *List)
- func (l *List) PushFront(value interface{}) *Element
- func (l *List) PushFrontList(ol *List)
- func (l *List) Remove(e *Element) interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Element ¶
type Element struct { // The contents of this list element. Value interface{} // contains filtered or unexported fields }
Element is an element in the linked list.
type List ¶
type List struct {
// contains filtered or unexported fields
}
List represents a doubly linked list. The zero value for List is an empty list ready to use.
func (*List) InsertAfter ¶
InsertAfter inserts the value immediately after mark and returns a new Element containing the value.
func (*List) InsertBefore ¶
InsertBefore inserts the value immediately before mark and returns a new Element containing the value.
func (*List) MoveToBack ¶
MoveToBack moves the element to the back of the list.
func (*List) MoveToFront ¶
MoveToFront moves the element to the front of the list.
func (*List) PushBack ¶
PushBack inserts the value at the back of the list and returns a new Element containing the value.
func (*List) PushBackList ¶
PushBackList inserts each element of ol at the back of the list.
func (*List) PushFront ¶
PushFront inserts the value at the front of the list and returns a new Element containing the value.
func (*List) PushFrontList ¶
PushFrontList inserts each element of ol at the front of the list. The ordering of the passed list is preserved.