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 ¶
NewArrayDeque creates a new Deque backed by an array.
func NewLinkedListDeque ¶
NewLinkedListDeque creates a new Deque backed by a linked list.
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.