queue

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: MIT 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[T comparable] struct {
	// contains filtered or unexported fields
}

Queue is the main queue type.

func New

func New[T comparable]() Queue[T]

New is used to create a new queue.

func (*Queue[T]) Clear

func (q *Queue[T]) Clear()

Clear empties the entire queue.

func (Queue[T]) Contains

func (q Queue[T]) Contains(val T) bool

Contains returns true if the value exists in the queue, false if not.

func (Queue[T]) Count

func (q Queue[T]) Count() int

Count returns the amount of entries in the queue.

func (*Queue[T]) Dequeue

func (q *Queue[T]) Dequeue() T

Dequeue returns the first value and removes it.

func (Queue[T]) Empty

func (q Queue[T]) Empty() bool

Empty returns true if the queue is empty, false if not.

func (*Queue[T]) Enqueue

func (q *Queue[T]) Enqueue(val T)

Enqueue add a value to the queue.

func (Queue[T]) ForEach

func (q Queue[T]) ForEach(f func(val T))

ForEach iterates over the dataset within the queue, calling the passed function for each value.

func (Queue[T]) Peek

func (q Queue[T]) Peek() T

Peek returns the first value.

Jump to

Keyboard shortcuts

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