list

package
v0.0.0-...-90c9d3a Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2010 License: BSD-3-Clause, GooglePatentClause Imports: 0 Imported by: 0

Documentation

Overview

The list package implements a doubly linked list.

Index

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.

func (*Element) Next

func (e *Element) Next() *Element

Next returns the next list element or nil.

func (*Element) Prev

func (e *Element) Prev() *Element

Prev returns the previous list element or nil.

type List

type List struct {
	// contains filtered or unexported fields
}

List represents a doubly linked list.

func New

func New() *List

New returns an initialized list.

func (*List) Back

func (l *List) Back() *Element

Back returns the last element in the list.

func (*List) Front

func (l *List) Front() *Element

Front returns the first element in the list.

func (*List) Init

func (l *List) Init() *List

Init initializes or clears a List.

func (*List) InsertAfter

func (l *List) InsertAfter(value interface{}, mark *Element) *Element

InsertAfter inserts the value immediately after mark and returns a new Element containing the value.

func (*List) InsertBefore

func (l *List) InsertBefore(value interface{}, mark *Element) *Element

InsertBefore inserts the value immediately before mark and returns a new Element containing the value.

func (*List) Iter

func (l *List) Iter() <-chan interface{}

func (*List) Len

func (l *List) Len() int

Len returns the number of elements in the list.

func (*List) MoveToBack

func (l *List) MoveToBack(e *Element)

MoveToBack moves the element to the back of the list.

func (*List) MoveToFront

func (l *List) MoveToFront(e *Element)

MoveToFront moves the element to the front of the list.

func (*List) PushBack

func (l *List) PushBack(value interface{}) *Element

PushBack inserts the value at the back of the list and returns a new Element containing the value.

func (*List) PushBackList

func (l *List) PushBackList(ol *List)

PushBackList inserts each element of ol at the back of the list.

func (*List) PushFront

func (l *List) PushFront(value interface{}) *Element

PushFront inserts the value at the front of the list and returns a new Element containing the value.

func (*List) PushFrontList

func (l *List) PushFrontList(ol *List)

PushFrontList inserts each element of ol at the front of the list. The ordering of the passed list is preserved.

func (*List) Remove

func (l *List) Remove(e *Element)

Remove removes the element from the list.

Jump to

Keyboard shortcuts

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