Documentation ¶
Index ¶
- type List
- type SimpleList
- func (l *SimpleList) Back() interface{}
- func (l *SimpleList) Find(i interface{}) bool
- func (l *SimpleList) Foreach(f func(interface{}) bool)
- func (l *SimpleList) Front() interface{}
- func (l *SimpleList) Len() int
- func (l *SimpleList) PopBack() interface{}
- func (l *SimpleList) PopFront() interface{}
- func (l *SimpleList) PushBack(o interface{})
- func (l *SimpleList) PushFront(o interface{})
- func (l *SimpleList) Remove(o interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type List ¶
type List interface { // 在链表尾部添加一个元素 // Param:o 添加的对象 PushBack(o interface{}) // 在链表首部添加一个元素 // Param:o 添加的对象 PushFront(o interface{}) // 删除元素 // Param:o 添加的对象 Remove(o interface{}) // 获得首元素 // Return: 首元素(第一个元素),如果没有返回nil Front() interface{} // 获得尾元素 // Return: 尾元素(最后一个元素),如果没有返回nil Back() interface{} // 获得首元素并移除 // Return: 首元素(第一个元素),如果没有返回nil PopFront() interface{} // 获得尾元素并移除 // Return: 尾元素(最后一个元素),如果没有返回nil PopBack() interface{} // 获得链表长度 // Return: 链表长度 Len() int // 轮询链表O(N) // Param:接受轮询的函数,返回true继续轮询,返回false终止轮询 Foreach(f func(interface{}) bool) // 查询链表中是否存在参数对象 // Param:查询的对象 // Return:存在返回true,不存在返回false Find(i interface{}) bool }
type SimpleList ¶
type SimpleList struct {
// contains filtered or unexported fields
}
func NewSimpleList ¶
func NewSimpleList() *SimpleList
func (*SimpleList) Back ¶
func (l *SimpleList) Back() interface{}
获得尾元素 Return: 尾元素(最后一个元素),如果没有返回nil
func (*SimpleList) Find ¶
func (l *SimpleList) Find(i interface{}) bool
查询链表中是否存在参数对象O(N) Param:查询的对象 Return:存在返回true,不存在返回false
func (*SimpleList) Foreach ¶
func (l *SimpleList) Foreach(f func(interface{}) bool)
轮询链表O(N) Param:接受轮询的函数,返回true继续轮询,返回false终止轮询
func (*SimpleList) Front ¶
func (l *SimpleList) Front() interface{}
获得首元素 Return: 首元素(第一个元素),如果没有返回nil
func (*SimpleList) PopBack ¶
func (l *SimpleList) PopBack() interface{}
获得尾元素并移除 Return: 尾元素(最后一个元素),如果没有返回nil
func (*SimpleList) PopFront ¶
func (l *SimpleList) PopFront() interface{}
获得首元素并移除 Return: 首元素(第一个元素),如果没有返回nil
func (*SimpleList) PushBack ¶
func (l *SimpleList) PushBack(o interface{})
在链表尾部添加一个元素 Param:o 添加的对象
func (*SimpleList) PushFront ¶
func (l *SimpleList) PushFront(o interface{})
在链表首部添加一个元素 Param:o 添加的对象
Click to show internal directories.
Click to hide internal directories.