Queue

package
v0.0.0-...-da200cc Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

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

func (*Queue) Append

func (l *Queue) Append(key string, data interface{})

Append an element at tail of list

func (*Queue) Clear

func (l *Queue) Clear()

Clear remove all elements from list

func (*Queue) Filter

func (l *Queue) Filter(filter func(key string, value interface{}) bool)

Filter, if filter return true, will remove those elements

func (*Queue) Shift

func (l *Queue) Shift() (key string, data interface{})

Shift will remove the first element of list

func (*Queue) Size

func (l *Queue) Size() int

Size indicate how many elements in list

func (*Queue) Traverse

func (l *Queue) Traverse(handler func(key string, value interface{}) bool)

Traverse list, if handler return false, will not iterate forward elements

func (*Queue) UnShift

func (l *Queue) UnShift(key string, data interface{})

UnShift use to insert an element to front of list

type UniqueList

type UniqueList interface {
	Append(key string, data interface{})
	Shift() (key string, data interface{})
	UnShift(key string, data interface{})
	Traverse(handler func(key string, data interface{}) bool)
	Filter(filter func(key string, data interface{}) bool)
	Size() int
	Clear()
}

func New

func New() UniqueList

New create a linked list

Jump to

Keyboard shortcuts

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