Documentation ¶
Index ¶
- type Element
- type List
- func (that *List) Back() (e *Element)
- func (that *List) BackAll() (values []interface{})
- func (that *List) BackValue() (value interface{})
- func (that *List) Clear()
- func (that *List) Front() (e *Element)
- func (that *List) FrontAll() (values []interface{})
- func (that *List) FrontValue() (value interface{})
- func (that *List) InsertAfter(p *Element, v interface{}) (e *Element)
- func (that *List) InsertBefore(p *Element, v interface{}) (e *Element)
- func (that *List) Iterator(f func(e *Element) bool)
- func (that *List) IteratorAsc(f func(e *Element) bool)
- func (that *List) IteratorDesc(f func(e *Element) bool)
- func (that *List) Join(glue string) string
- func (that *List) Len() (length int)
- func (that *List) LockFunc(f func(list *list.List))
- func (that *List) MarshalJSON() ([]byte, error)
- func (that *List) MoveAfter(e, p *Element)
- func (that *List) MoveBefore(e, p *Element)
- func (that *List) MoveToBack(e *Element)
- func (that *List) MoveToFront(e *Element)
- func (that *List) PopBack() interface{}
- func (that *List) PopBackAll() []interface{}
- func (that *List) PopBacks(max int) (values []interface{})
- func (that *List) PopFront() interface{}
- func (that *List) PopFrontAll() []interface{}
- func (that *List) PopFronts(max int) (values []interface{})
- func (that *List) PushBack(v interface{}) *Element
- func (that *List) PushBackList(other *List)
- func (that *List) PushBacks(values []interface{})
- func (that *List) PushFront(v interface{}) *Element
- func (that *List) PushFrontList(other *List)
- func (that *List) PushFronts(values []interface{})
- func (that *List) RLockFunc(f func(list *list.List))
- func (that *List) Remove(e *Element) (value interface{})
- func (that *List) RemoveAll()
- func (that *List) Removes(es []*Element)
- func (that *List) Size() int
- func (that *List) String() string
- func (that *List) UnmarshalJSON(b []byte) error
- func (that *List) UnmarshalValue(value interface{}) (err error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type List ¶
type List struct {
// contains filtered or unexported fields
}
List 是一个包含并发安全开关的双向链表,开关在对象创建的时候确认,并且不能更改。
func New ¶
New 创建
Example ¶
package main import ( "fmt" "github.com/osgochina/donkeygo/container/dlist" ) func main() { n := 10 l := dlist.New() for i := 0; i < n; i++ { l.PushBack(i) } fmt.Println(l.Len()) fmt.Println(l.FrontAll()) fmt.Println(l.BackAll()) for i := 0; i < n; i++ { fmt.Print(l.PopFront()) } l.Clear() fmt.Println() fmt.Println(l.Len()) }
Output: 10 [0 1 2 3 4 5 6 7 8 9] [9 8 7 6 5 4 3 2 1 0] 0123456789 0
func (*List) InsertAfter ¶
InsertAfter 插入值v到节点p的后面,并返回该节点
func (*List) InsertBefore ¶
InsertBefore 插入值v到节点p的前面,并返回该节点
func (*List) IteratorAsc ¶
IteratorAsc 从头开始迭代
func (*List) IteratorDesc ¶
IteratorDesc 从尾部开始迭代
func (*List) PopFrontAll ¶
func (that *List) PopFrontAll() []interface{}
PopFrontAll 从链表头部开始取,取出全部的值
func (*List) PushBackList ¶
PushBackList 把链表other链接到链表的尾部
func (*List) PushFrontList ¶
PushFrontList 把链表other链接到链表的头部
func (*List) UnmarshalJSON ¶
UnmarshalJSON 把json串反序列化成链表
func (*List) UnmarshalValue ¶
UnmarshalValue 解码内容
Click to show internal directories.
Click to hide internal directories.