queue

package
v0.4.43 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: MIT 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[T any] struct {
	// contains filtered or unexported fields
}

Queue represents a double-ended queue. The zero value is an empty queue ready to use.

func New

func New[T any](initialCapacity int) *Queue[T]

New returns an initialized empty queue.

func (*Queue[T]) Back

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

Back returns the last element of queue q or nil.

func (*Queue[T]) Front

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

Front returns the first element of queue q or nil.

func (*Queue[T]) Len

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

Len returns the number of elements of queue q.

func (*Queue[T]) PopBack

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

PopBack removes and returns the last element of queue q or nil.

func (*Queue[T]) PopFront

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

PopFront removes and returns the first element of queue q or nil.

func (*Queue[T]) PushBack

func (q *Queue[T]) PushBack(v T)

PushBack inserts a new value v at the back of queue q.

func (*Queue[T]) PushFront

func (q *Queue[T]) PushFront(v T)

PushFront inserts a new value v at the front of queue q.

func (*Queue[T]) String

func (q *Queue[T]) String() string

String returns a string representation of queue q formatted from front to back.

Jump to

Keyboard shortcuts

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