Skip to content

RingVector

Defined in: packages/data/src/storage/ring-vector.ts:36

A wrap-around (“ring”) vector: the storage tier of CircularArrayList, without the list surface.

This is the fastest general-purpose backing in the package and the default under Queue, Deque and Stack. It carries no cursors, no predicate search and no splice, so its end operations are pure index arithmetic over one flat array. Reach for CircularArrayList instead when the extra IList surface is actually needed.

Time complexity: - Access/update by index: O(1) - Insert/remove at either end: O(1) amortised (O(1) worst case when constructed with a capacity) Space complexity: O(n)

T extends DefinedValue

The type of elements. Anything except undefined, which marks an empty slot.

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

Defined in: packages/data/src/storage/ring-vector.ts:47

Iterable<T, any, any>

RingVectorOptions

RingVector<T>

readonly capacity: number

Defined in: packages/data/src/storage/ring-vector.ts:45

Infinity when the vector grows on demand.

[iterator](): Iterator<T>

Defined in: packages/data/src/storage/ring-vector.ts:89

Iterator<T>

IListStorage.[iterator]


back(): T | undefined

Defined in: packages/data/src/storage/ring-vector.ts:170

T | undefined

IListStorage.back


clear(): void

Defined in: packages/data/src/storage/ring-vector.ts:99

void

IListStorage.clear


count(): number

Defined in: packages/data/src/storage/ring-vector.ts:95

number

IListStorage.count


front(): T | undefined

Defined in: packages/data/src/storage/ring-vector.ts:218

T | undefined

IListStorage.front


get(index): T | undefined

Defined in: packages/data/src/storage/ring-vector.ts:111

number

T | undefined

IListStorage.get


popBack(): T | undefined

Defined in: packages/data/src/storage/ring-vector.ts:152

T | undefined

IListStorage.popBack


popFront(): T | undefined

Defined in: packages/data/src/storage/ring-vector.ts:202

T | undefined

IListStorage.popFront


pushBack(item): void

Defined in: packages/data/src/storage/ring-vector.ts:127

T

void

IListStorage.pushBack


pushBackAll(items): void

Defined in: packages/data/src/storage/ring-vector.ts:134

Iterable<T>

void

IListStorage.pushBackAll


pushFront(item): void

Defined in: packages/data/src/storage/ring-vector.ts:178

T

void

IListStorage.pushFront


pushFrontAll(items): void

Defined in: packages/data/src/storage/ring-vector.ts:186

readonly T[]

void

IListStorage.pushFrontAll


set(index, item): void

Defined in: packages/data/src/storage/ring-vector.ts:119

number

T

void

IListStorage.set