list

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TElement

type TElement struct {

	// 保存的值。需要明确信息后,进行强制转换  person,ok := e.Value.(Persion)
	Value interface{}
	// contains filtered or unexported fields
}

*

@author: lgh
@date: 2022/2/23
@note

* 列表保存结构

func (*TElement) Next

func (e *TElement) Next() *TElement

列表元素下一个

func (*TElement) Prev

func (e *TElement) Prev() *TElement

列表元素上一个

type TList

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

双向列表,非线程安全,涉及到增加,删除,遍历时,需要添加Mutex自行解决线程安全

func NewList

func NewList() *TList

新建列表

func (*TList) Clear

func (l *TList) Clear()

func (*TList) Delete

func (l *TList) Delete(e *TElement) error

删除一个指定的元素,返回失败标识。如果成功,返回Nil

func (*TList) Front

func (l *TList) Front() *TElement

返回第一个列表元素

func (*TList) Init

func (l *TList) Init() *TList

初始化列表

func (*TList) Insert

func (l *TList) Insert(val interface{}) *TElement

在列表前面添加元素,返回本次添加的Element指针

func (*TList) Len

func (l *TList) Len() int

返回列表长度

func (*TList) Pop

func (l *TList) Pop() *TElement

弹出第一个列表元素

func (*TList) Push

func (l *TList) Push(val interface{}) *TElement

在列表后面添加元素,返回本次添加的Element指针

func (*TList) Tail

func (l *TList) Tail() *TElement

返回最后一个列表元素

Jump to

Keyboard shortcuts

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