Documentation
¶
Index ¶
- type List
- func (l *List) BackNode() *Node
- func (l *List) FrontNode() *Node
- func (l *List) InsertAfter(v interface{}, mark *Node) *Node
- func (l *List) Len() int
- func (l *List) MoveToBack(pre, n *Node)
- func (l *List) MoveToFront(pre, n *Node)
- func (l *List) PushBack(v interface{})
- func (l *List) PushFront(v interface{})
- func (l *List) Remove(pre, n *Node) interface{}
- func (l *List) String() string
- func (l *List) Traversal(visitor visitor.Visitor)
- type ListIterator
- func (iter *ListIterator) Clone() iterator.ConstIterator
- func (iter *ListIterator) Equal(other iterator.ConstIterator) bool
- func (iter *ListIterator) IsValid() bool
- func (iter *ListIterator) Next() iterator.ConstIterator
- func (iter *ListIterator) SetValue(value interface{})
- func (iter *ListIterator) Value() interface{}
- type Node
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 represents a single direction list:
head -> node1 --> node2 --> node3 <- tail
func (*List) InsertAfter ¶
InsertAfter inserts a new node n with value v immediately after mark and returns n. If mark is not a node of the list, the list is not modified. The mark must not be nil.
func (*List) MoveToBack ¶
MoveToBack moves node n to the back of the list. The n must not be nil.
func (*List) MoveToFront ¶
MoveToFront moves node n to the front of the list. The n must not be nil.
func (*List) PushBack ¶
func (l *List) PushBack(v interface{})
PushBack inserts a new node n with value v at the back of the list.
func (*List) PushFront ¶
func (l *List) PushFront(v interface{})
PushFront inserts a new node n with value v at the front of the list.
type ListIterator ¶
type ListIterator struct {
// contains filtered or unexported fields
}
ListIterator is an iterator for list
func (*ListIterator) Clone ¶
func (iter *ListIterator) Clone() iterator.ConstIterator
Clone clones iter to a new ListIterator
func (*ListIterator) Equal ¶
func (iter *ListIterator) Equal(other iterator.ConstIterator) bool
Equal returns whether iter is equal to other
func (*ListIterator) IsValid ¶
func (iter *ListIterator) IsValid() bool
IsValid returns whether iter is valid
func (*ListIterator) Next ¶
func (iter *ListIterator) Next() iterator.ConstIterator
Next returns the next iterator
func (*ListIterator) SetValue ¶
func (iter *ListIterator) SetValue(value interface{})
SetValue sets the value of iter
func (*ListIterator) Value ¶
func (iter *ListIterator) Value() interface{}
Value returns the internal value of iter