deque

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Overview

Package deque implements a deque using a circular array.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type T

type T struct {
	// contains filtered or unexported fields
}

T is the type of queues.

func (*T) Back

func (q *T) Back() interface{}

Back returns the last element of the deque, or nil if there is none.

func (*T) Clear

func (q *T) Clear()

Clear removes all the elements of the queue.

func (*T) Front

func (q *T) Front() interface{}

Front returns the first element of the deque, or nil if there is none.

func (*T) Iter

func (q *T) Iter(f func(item interface{}) bool)

Iter iterates over the elements of the deque. f should return false to terminate the iteration early.

func (*T) PopBack

func (q *T) PopBack() interface{}

PopBack removes an element from the front of the queue and returns it.

func (*T) PopFront

func (q *T) PopFront() interface{}

PopFront removes an element from the front of the queue and returns it.

func (*T) PushBack

func (q *T) PushBack(item interface{})

PushBack adds an element to the back of the queue.

func (*T) PushFront

func (q *T) PushFront(item interface{})

PushFront adds an element to the front of the deque.

func (*T) Size

func (q *T) Size() int

Size returns the number of items in the queue.

Jump to

Keyboard shortcuts

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