queue

package
v0.0.0-...-8cfa9df Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

A queue gives you a FIFO or first-in firs-out order. The element you inserted first is also the first one to come out again.

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 FIFO (first-in first-out) list

func New

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

func (*Queue[T]) Clear

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

func (*Queue[T]) Dequeue

func (q *Queue[T]) Dequeue() (value T, ok bool)

Dequeue removes the first item from the queue and returns it

func (*Queue[T]) Empty

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

func (*Queue[T]) Enqueue

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

Enqueue puts a given item at the back of the queue

func (*Queue[T]) Front

func (q *Queue[T]) Front() (value T, ok bool)

Front returns the first item of the queue

func (*Queue[T]) Len

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

func (*Queue[T]) Values

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

Jump to

Keyboard shortcuts

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