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)
Type Parameters
Section titled “Type Parameters”T extends DefinedValue
The type of elements. Anything except undefined, which marks an
empty slot.
Implements
Section titled “Implements”IListStorage<T>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RingVector<
T>(iterable?,options?):RingVector<T>
Defined in: packages/data/src/storage/ring-vector.ts:47
Parameters
Section titled “Parameters”iterable?
Section titled “iterable?”Iterable<T, any, any>
options?
Section titled “options?”Returns
Section titled “Returns”RingVector<T>
Properties
Section titled “Properties”capacity
Section titled “capacity”
readonlycapacity:number
Defined in: packages/data/src/storage/ring-vector.ts:45
Infinity when the vector grows on demand.
Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”[iterator]():
Iterator<T>
Defined in: packages/data/src/storage/ring-vector.ts:89
Returns
Section titled “Returns”Iterator<T>
Implementation of
Section titled “Implementation of”IListStorage.[iterator]
back()
Section titled “back()”back():
T|undefined
Defined in: packages/data/src/storage/ring-vector.ts:170
Returns
Section titled “Returns”T | undefined
Implementation of
Section titled “Implementation of”IListStorage.back
clear()
Section titled “clear()”clear():
void
Defined in: packages/data/src/storage/ring-vector.ts:99
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IListStorage.clear
count()
Section titled “count()”count():
number
Defined in: packages/data/src/storage/ring-vector.ts:95
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”IListStorage.count
front()
Section titled “front()”front():
T|undefined
Defined in: packages/data/src/storage/ring-vector.ts:218
Returns
Section titled “Returns”T | undefined
Implementation of
Section titled “Implementation of”IListStorage.front
get(
index):T|undefined
Defined in: packages/data/src/storage/ring-vector.ts:111
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”T | undefined
Implementation of
Section titled “Implementation of”IListStorage.get
popBack()
Section titled “popBack()”popBack():
T|undefined
Defined in: packages/data/src/storage/ring-vector.ts:152
Returns
Section titled “Returns”T | undefined
Implementation of
Section titled “Implementation of”IListStorage.popBack
popFront()
Section titled “popFront()”popFront():
T|undefined
Defined in: packages/data/src/storage/ring-vector.ts:202
Returns
Section titled “Returns”T | undefined
Implementation of
Section titled “Implementation of”IListStorage.popFront
pushBack()
Section titled “pushBack()”pushBack(
item):void
Defined in: packages/data/src/storage/ring-vector.ts:127
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IListStorage.pushBack
pushBackAll()
Section titled “pushBackAll()”pushBackAll(
items):void
Defined in: packages/data/src/storage/ring-vector.ts:134
Parameters
Section titled “Parameters”Iterable<T>
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IListStorage.pushBackAll
pushFront()
Section titled “pushFront()”pushFront(
item):void
Defined in: packages/data/src/storage/ring-vector.ts:178
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IListStorage.pushFront
pushFrontAll()
Section titled “pushFrontAll()”pushFrontAll(
items):void
Defined in: packages/data/src/storage/ring-vector.ts:186
Parameters
Section titled “Parameters”readonly T[]
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IListStorage.pushFrontAll
set(
index,item):void
Defined in: packages/data/src/storage/ring-vector.ts:119
Parameters
Section titled “Parameters”number
T
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IListStorage.set