queue

package
v0.115.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 1 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 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