A vector class that implements a persistent array.

**Vector**

constructor

back

first

front

isEmpty

last

length

containsIndex

delete

pop

popBack

push

pushBack

⊕ **new Vector**(prefix: * string*): Vector

*Defined in **near.ts:266*

Creates or restores a persistent vector with a given storage prefix. Always use a unique storage prefix for different collections.

**Parameters:**

Name | Type | Description |

prefix |
| A prefix to use for every key of this vector. |

**Returns:** Vector

getback(): `T`

*Defined in **near.ts:422*

**Returns:** `T`

The last element of the vector. Asserts that the vector is not empty.

getfirst(): `T`

*Defined in **near.ts:445*

**Returns:** `T`

The first element of the vector. Asserts that the vector is not empty.

getfront(): `T`

*Defined in **near.ts:437*

**Returns:** `T`

The first element of the vector. Asserts that the vector is not empty.

getisEmpty(): `bool`

*Defined in **near.ts:307*

**Returns:** `bool`

True if the vector is empty.

getlast(): `T`

*Defined in **near.ts:430*

**Returns:** `T`

The last element of the vector. Asserts that the vector is not empty.

getlength(): `i32`

*Defined in **near.ts:314*

**Returns:** `i32`

The length of the vector.

▸ **containsIndex**(index: * i32*):

`bool`

*Defined in **near.ts:300*

**Parameters:**

Name | Type | Description |

index |
| The index to check. |

**Returns:** `bool`

True if the given index is within the range of the vector indices.

▸ **delete**(index: * i32*):

`void`

*Defined in **near.ts:291*

Removes the content of the element from storage without changing length of the vector.

**Parameters:**

Name | Type | Description |

index |
| The index of the element to remove. |

**Returns:** `void`

▸ **pop**(): `T`

*Defined in **near.ts:400*

Removes the last element from the vector and returns it. Asserts that the vector is not empty. Decreases the length of the vector.

**Returns:** `T`

The removed last element of the vector.

▸ **popBack**(): `T`

*Defined in **near.ts:415*

Removes the last element from the vector and returns it. Asserts that the vector is not empty. Decreases the length of the vector.

**Returns:** `T`

The removed last element of the vector.

▸ **push**(element: * T*):

`i32`

*Defined in **near.ts:378*

Adds a new element to the end of the vector. Increases the length of the vector.

**Parameters:**

Name | Type | Description |

element |
| A new element to add. |

**Returns:** `i32`

The index of a newly added element

▸ **pushBack**(element: * T*):

`i32`

*Defined in **near.ts:391*

Adds a new element to the end of the vector. Increases the length of the vector.

**Parameters:**

Name | Type | Description |

element |
| A new element to add. |

**Returns:** `i32`

The index of a newly added element