The type of element in the collection.
Construct a new vector.
const v1 = new Vector<number>([1, 2, 3, 4, 5])
assert.strictEqual(v.size, 5)
const v2 = new Vector<number>({ capacity: 1024 })
for (let i = 0; i < 1024; i++) {
v2.append(i)
}
Additional options to customize the newly created vector.
Get how much elements this vector can hold before it needs to re-allocate.
Get how many elements are actually in the container.
Returns an object which is able to sift through the values in this collection.
The order by which the elements are traversed depends on the kind of collection. For unordered collections, the iteration order is unspecified and may even differ between two iterations on the same collection.
Ensure the vector can store at least count
amount of elements.
The size property of this vector is never changed during this call.
Return a cursor that is placed at the index given by position
in the
sequence.
Remove all elements from this collection, effectively setting the collection to the empty collection.
Copies all elements in the collection to a new one of the same kind.
Get the first element in the sequence.
Allows taking an element directly out of the collection at a given position.
This method might be faster than at because it is not forced to construct a cursor object.
Get the last element in the collection.
Converts the entire collection to a range.
Generated using TypeDoc
A vector is a sequence with fast member access by sequence number.
Inserting elements anywhere else than at the end is very slow and should be avoided. When inserting, the vector may need to re-allocate to provide enough room for the new element.
The following table summarises the time complexity of the most commonly used properties.
DoubleLinkedList
SingleLinkedList