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)
}
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.
Add an element to the collection. If the element already exists, update its value.
The location where the element is placed depends on the collection type, and in the generic case there is no guarantee on the location where it is inserted.
This method returns a pair with the first element indicating whether the element was added, while the second element refers to the actual location of the element.
Ensure the vector can store at least count
amount of elements.
The size property of this vector is never changed during this call.
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.
See