colseq

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deque

type Deque[T any] struct {
	// contains filtered or unexported fields
}

Deque is a double-ended queue. It is a sequence of elements in which items can be inserted or removed from either the front or back. Pushing is always possible, but popping and peeking panics if the deque is empty.

func From

func From[T any](collection cols.Collection[T]) Deque[T]

From creates a new Deque from a collection.

func NewArrayDeque

func NewArrayDeque[T any]() Deque[T]

NewArrayDeque creates a new Deque backed by an array.

func NewLinkedListDeque

func NewLinkedListDeque[T any]() Deque[T]

NewLinkedListDeque creates a new Deque backed by a linked list.

func (Deque[T]) Empty

func (deque Deque[T]) Empty() bool

Empty returns true if the Deque is empty.

func (Deque[T]) PeekBack

func (deque Deque[T]) PeekBack() T

PeekBack returns the element at the back of the Deque. Panics if the Deque is empty.

func (Deque[T]) PeekFront

func (deque Deque[T]) PeekFront() T

PeekFront returns the element at the front of the Deque. Panics if the Deque is empty.

func (Deque[T]) PopBack

func (deque Deque[T]) PopBack() T

PopBack removes and returns the element at the back of the Deque. Panics if the Deque is empty.

func (Deque[T]) PopFront

func (deque Deque[T]) PopFront() T

PopFront removes and returns the element at the front of the Deque. Panics if the Deque is empty.

func (Deque[T]) PushBack

func (deque Deque[T]) PushBack(value T)

PushBack inserts an element at the back of the Deque.

func (Deque[T]) PushFront

func (deque Deque[T]) PushFront(value T)

PushFront inserts an element at the front of the Deque.

Jump to

Keyboard shortcuts

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