linkedlist

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(element IElement)

Add Add element

func Clear

func Clear()

Clear Initialize

func Iter

func Iter() func() IElement

Iter Iter, not thread safe

func IterElement

func IterElement(function func(element IElement) bool)

IterElement Iter, thread safe

func Len

func Len() int

Len Len of elements

func Remove

func Remove(element IElement)

Remove Remove element

func Removes

func Removes(elements []IElement)

Removes Remove element

Types

type IElement

type IElement interface {
	Serialize() []byte
}

IElement Interface for element of LinkedList

func Get

func Get(n int) (elements []IElement)

Get Get num elements from head

func Has

func Has(element IElement) IElement

Has Contains

func RemoveAll

func RemoveAll() (elements []IElement)

RemoveAll Remove all elements

func RemoveBefore

func RemoveBefore(element IElement) (elements []IElement)

RemoveBefore Remove elements before element

type LinkedList

type LinkedList struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

LinkedList Define LinkedList struct

func NewLinkedList

func NewLinkedList() *LinkedList

NewLinkedList Create LinkedList instance

func (*LinkedList) Add

func (lst *LinkedList) Add(element IElement)

Add Add element

func (*LinkedList) Clear

func (lst *LinkedList) Clear()

Clear Initialize

func (*LinkedList) Get

func (lst *LinkedList) Get(n int) (elements []IElement)

Get Get num elements from head

func (*LinkedList) Has

func (lst *LinkedList) Has(element IElement) IElement

Has Contains

func (*LinkedList) Iter

func (lst *LinkedList) Iter() func() IElement

Iter Iter, not thread safe

func (*LinkedList) IterElement

func (lst *LinkedList) IterElement(function func(element IElement) bool) bool

IterElement Iter, thread safe

func (*LinkedList) Len

func (lst *LinkedList) Len() int

Len Len of elements

func (*LinkedList) Remove

func (lst *LinkedList) Remove(element IElement)

Remove Remove element

func (*LinkedList) RemoveAll

func (lst *LinkedList) RemoveAll() (elements []IElement)

RemoveAll Remove all elements

func (*LinkedList) RemoveBefore

func (lst *LinkedList) RemoveBefore(element IElement) (elements []IElement)

RemoveBefore Remove elements before element

func (*LinkedList) Removes

func (lst *LinkedList) Removes(elements []IElement)

Removes Remove element

Jump to

Keyboard shortcuts

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