Skip to content

BoundedDeque

Defined in: packages/data/src/deque/bounded-deque.ts:22

A double-ended queue that holds at most capacity items and throws once full.

T extends DefinedValue

The type of elements in the deque.

new BoundedDeque<T>(iterable?, options?): BoundedDeque<T>

Defined in: packages/data/src/deque/bounded-deque.ts:28

Iterable<T, any, any>

BoundedDequeOptions<T>

BoundedDeque<T>

readonly capacity: number

Defined in: packages/data/src/deque/bounded-deque.ts:26

The maximum number of elements the collection can hold.

Note: Infinity is not a legal value here — an unbounded type omits this mixin.

IBounded.capacity

[iterator](): Iterator<T>

Defined in: packages/data/src/deque/bounded-deque.ts:48

Iterator<T>

IDeque.[iterator]


back(): T | undefined

Defined in: packages/data/src/deque/bounded-deque.ts:134

Returns the item at the back of the deque without removing it.

T | undefined

The item at the back of the deque, or undefined if the deque is empty.

IDeque.back


clear(): void

Defined in: packages/data/src/deque/bounded-deque.ts:52

Removes all elements from the collection.

void

IDeque.clear


count(): number

Defined in: packages/data/src/deque/bounded-deque.ts:56

The number of elements in the collection.

A method, not a getter: its async counterpart needs a round trip to the backing store, and a member must have the same shape in both.

number

IDeque.count


front(): T | undefined

Defined in: packages/data/src/deque/bounded-deque.ts:130

Returns the item at the front of the deque without removing it.

T | undefined

The item at the front of the deque, or undefined if the deque is empty.

IDeque.front


pop(): T | undefined

Defined in: packages/data/src/deque/bounded-deque.ts:126

Removes and returns the item at the back of the deque.

T | undefined

The item at the back of the deque, or undefined if the deque is empty.

IDeque.pop


push(item): void

Defined in: packages/data/src/deque/bounded-deque.ts:98

Same as IDeque.push, but throws once the deque is full.

T

void

If the operation would exceed the deque’s capacity.

IDeque.push

IDeque.push


pushAll(items): void

Defined in: packages/data/src/deque/bounded-deque.ts:112

Same as IDeque.pushAll, but throws once the deque is full. Nothing is added when it throws — the check is made against the whole batch.

readonly T[]

void

If the operation would exceed the deque’s capacity.

IDeque.pushAll

IDeque.pushAll


shift(): T | undefined

Defined in: packages/data/src/deque/bounded-deque.ts:122

Removes and returns the item at the front of the deque.

T | undefined

The item at the front of the deque, or undefined if the deque is empty.

IDeque.shift


unshift(item): void

Defined in: packages/data/src/deque/bounded-deque.ts:67

Same as IDeque.unshift, but throws once the deque is full.

T

void

If the operation would exceed the deque’s capacity.

IDeque.unshift

IDeque.unshift


unshiftAll(items): void

Defined in: packages/data/src/deque/bounded-deque.ts:81

Same as IDeque.unshiftAll, but throws once the deque is full. Nothing is added when it throws — the check is made against the whole batch.

readonly T[]

void

If the operation would exceed the deque’s capacity.

IDeque.unshiftAll

IDeque.unshiftAll