queue

package
v0.152.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](elems ...T) Queue[T]

New creates a new Queue.

func (*Queue[T]) Append

func (sq *Queue[T]) Append(elems ...T)

Append adds new elements to the queue.

func (*Queue[T]) Copy

func (sq *Queue[T]) Copy() Queue[T]

Copy returns a copy of the queue.

func (*Queue[_]) IsEmpty

func (sq *Queue[_]) IsEmpty() bool

IsEmpty returns true if the queue is empty.

func (*Queue[_]) Len

func (sq *Queue[_]) Len() int

Len returns the length of the queue.

func (*Queue[T]) Peek

func (sq *Queue[T]) Peek() (T, error)

Peek returns the first element of the queue without removing it. Returns an error if called on an empty queue.

func (*Queue[T]) Pop

func (sq *Queue[T]) Pop() (T, error)

Pop returns the first element and removes it from the queue. Returns an error if called on an empty queue.

Jump to

Keyboard shortcuts

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