linkedlist

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CircularIterator

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

func (*CircularIterator) Next

func (iter *CircularIterator) Next() bool

func (*CircularIterator) Prev

func (iter *CircularIterator) Prev() bool

func (*CircularIterator) ToHead

func (iter *CircularIterator) ToHead()

func (*CircularIterator) ToTail

func (iter *CircularIterator) ToTail()

func (*CircularIterator) Value

func (iter *CircularIterator) Value() interface{}

type InsertState

type InsertState int

InsertState InsertIf的every函数的枚举 从左到右 1 为前 2 为后 insert here(2) ->cur-> insert here(1) UninsertAndContinue 不插入并且继续 UninsertAndBreak 不插入并且停止 InsertBack cur后插入并且停止 InsertFront cur前插入并且停止

const (
	// UninsertAndContinue 不插入并且继续
	UninsertAndContinue InsertState = 0
	// UninsertAndBreak 不插入并且停止
	UninsertAndBreak InsertState = -1
	// InsertBack cur后插入并且停止
	InsertBack InsertState = 2
	// InsertFront cur前插入并且停止
	InsertFront InsertState = 1
)

type Iterator

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

func (*Iterator) Next

func (iter *Iterator) Next() bool

func (*Iterator) Prev

func (iter *Iterator) Prev() bool

func (*Iterator) ToHead

func (iter *Iterator) ToHead()

func (*Iterator) ToTail

func (iter *Iterator) ToTail()

func (*Iterator) Value

func (iter *Iterator) Value() interface{}

type LinkedList

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

func New

func New() *LinkedList

func (*LinkedList) Back

func (l *LinkedList) Back() (result interface{}, found bool)

func (*LinkedList) CircularIterator

func (l *LinkedList) CircularIterator() *CircularIterator

func (*LinkedList) Clear

func (l *LinkedList) Clear()

func (*LinkedList) Contains

func (l *LinkedList) Contains(values ...interface{}) bool

func (*LinkedList) Empty

func (l *LinkedList) Empty() bool

func (*LinkedList) Find

func (l *LinkedList) Find(every func(idx uint, value interface{}) bool) (interface{}, bool)

func (*LinkedList) FindMany

func (l *LinkedList) FindMany(every func(idx uint, value interface{}) int) (result []interface{}, isfound bool)

func (*LinkedList) Front

func (l *LinkedList) Front() (result interface{}, found bool)

func (*LinkedList) Index

func (l *LinkedList) Index(idx int) (interface{}, bool)

func (*LinkedList) Insert

func (l *LinkedList) Insert(idx uint, values ...interface{}) bool

func (*LinkedList) InsertIf

func (l *LinkedList) InsertIf(every func(idx uint, value interface{}) InsertState, values ...interface{})

InsertIf every函数的枚举 从左到右遍历 1 为前 2 为后 insert here(2) ->cur-> insert here(1)

func (*LinkedList) Iterator

func (l *LinkedList) Iterator() *Iterator

func (*LinkedList) PopBack

func (l *LinkedList) PopBack() (result interface{}, found bool)

func (*LinkedList) PopFront

func (l *LinkedList) PopFront() (result interface{}, found bool)

func (*LinkedList) Push

func (l *LinkedList) Push(value interface{})

func (*LinkedList) PushBack

func (l *LinkedList) PushBack(values ...interface{})

func (*LinkedList) PushFront

func (l *LinkedList) PushFront(values ...interface{})

func (*LinkedList) Remove

func (l *LinkedList) Remove(idx int) (interface{}, bool)

func (*LinkedList) RemoveIf

func (l *LinkedList) RemoveIf(every func(idx uint, value interface{}) RemoveState) (result []interface{}, isRemoved bool)

RemoveIf every的遍历函数操作remove过程 如果没删除result 返回nil, isRemoved = false

func (*LinkedList) Size

func (l *LinkedList) Size() uint

func (*LinkedList) String

func (l *LinkedList) String() string

func (*LinkedList) Traversal

func (l *LinkedList) Traversal(every func(interface{}) bool)

func (*LinkedList) Values

func (l *LinkedList) Values() (result []interface{})

type Node

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

func (*Node) Value

func (node *Node) Value() interface{}

type RemoveState

type RemoveState int

RemoveState RemoveIf的every函数的枚举 RemoveAndContinue 删除并且继续 RemoveAndBreak 删除并且停止 UnremoveAndBreak 不删除并且停止遍历 UnremoveAndContinue 不删除并且继续遍历

const (
	// RemoveAndContinue 删除并且继续
	RemoveAndContinue RemoveState = iota
	// RemoveAndBreak 删除并且停止
	RemoveAndBreak
	// UnremoveAndBreak 不删除并且停止遍历
	UnremoveAndBreak
	// UnremoveAndContinue 不删除并且继续遍历
	UnremoveAndContinue
)

Jump to

Keyboard shortcuts

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