queue

package
v1.1.0-beta.0...-6806af4 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 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[T any] struct {
	// contains filtered or unexported fields
}

Queue is a circular buffer implementation of queue.

func NewQueue

func NewQueue[T any](capacity int) *Queue[T]

NewQueue creates a new queue with the given capacity.

func (*Queue[T]) Cap

func (r *Queue[T]) Cap() int

Cap returns the capacity of the queue.

func (*Queue[T]) Clear

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

Clear clears the queue.

func (*Queue[T]) ClearAndExpandIfNeed

func (r *Queue[T]) ClearAndExpandIfNeed(size int)

ClearAndExpandIfNeed clears the queue and try to expand the elements

func (*Queue[T]) IsEmpty

func (r *Queue[T]) IsEmpty() bool

IsEmpty returns true if the queue is empty.

func (*Queue[T]) Len

func (r *Queue[T]) Len() int

Len returns the number of elements in the queue.

func (*Queue[T]) Pop

func (r *Queue[T]) Pop() T

Pop pops an element from the queue.

func (*Queue[T]) Push

func (r *Queue[T]) Push(element T)

Push pushes an element to the queue.

Jump to

Keyboard shortcuts

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