queue

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2021 License: AGPL-3.0 Imports: 2 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 {
	PushCallback func(interface{})
	PopCallback  func(interface{})
	// contains filtered or unexported fields
}

Queue is a thread-safe FIFO queue data structure

func New added in v0.10.0

func New() *Queue

New returns a new empty Queue

func (*Queue) Empty

func (c *Queue) Empty() bool

Empty returns whether there's no elements in c

func (*Queue) Front

func (c *Queue) Front() interface{}

Front fetch the front element of c

func (*Queue) Pop

func (c *Queue) Pop() interface{}

Pop removes the front element of l and returns it. If the queue is empty, Pop waits for a new element to be enqueued, removes it and returns the value

func (*Queue) Push added in v0.10.0

func (c *Queue) Push(v interface{})

Push inserts a new element e with value v to the back of queue c

func (*Queue) Remove

func (c *Queue) Remove(Predicate func(v interface{}) bool) interface{}

Remove removes and returns the first element that Predicate(element.Value) returns true

func (*Queue) Size

func (c *Queue) Size() int

Size returns the number of elements in c

func (*Queue) Values added in v0.10.0

func (c *Queue) Values() (elements []interface{})

Values returns all the elements of c in a slice

Jump to

Keyboard shortcuts

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