Documentation
¶
Overview ¶
Package list copy from datastruct.list what is more: 1、add a func NewElement() to support get a single Element whithout set prev and next and list 2、add a func PushElementFront() to insert the single element to first of the list which created by call NewElement()
Index ¶
- type Element
- type List
- func (l *List) Back() *Element
- func (l *List) Front() *Element
- func (l *List) Init() *List
- func (l *List) Len() int
- func (l *List) MoveToBack(e *Element)
- func (l *List) MoveToFront(e *Element)
- func (l *List) NewElement(value interface{}) *Element
- func (l *List) PushBack(v interface{}) *Element
- func (l *List) PushElementFront(e *Element)
- func (l *List) PushFront(v interface{}) *Element
- 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 value stored with this element.
Value interface{}
// contains filtered or unexported fields
}
Element is an element of a 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) MoveToBack ¶
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) MoveToFront ¶
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) NewElement ¶
NewElement return a new single Element
func (*List) PushBack ¶
PushBack inserts a new element e with value v at the back of list l and returns e.
func (*List) PushElementFront ¶
PushElementFront insert a single element to list`s front