# ArrayDeque | data-structure-typed
Documentation for data-structure-typed

# Class ArrayDeque<T>

#### Type Parameters

- #### T

#### Hierarchy

- ArrayDeque

- Defined in src/data-structures/queue/deque.ts:170

#####
Index

### Constructors

constructor

### Properties

_nodes

### Accessors

size

### Methods

addFirst
addLast
get
insert
isEmpty
peekFirst
peekLast
pollFirst
pollLast
remove
set

## Constructors

### constructor

- new ArrayDeque<T>(): ArrayDeque <T>

- #### Type Parameters

  - #### T

  #### Returns ArrayDeque <T>

## Properties

### `Protected` _nodes

_nodes: T[] = []

- Defined in src/data-structures/queue/deque.ts:171

## Accessors

### size

- get size(): number

- #### Returns number

  - Defined in src/data-structures/queue/deque.ts:173

## Methods

### addFirst

- addFirst(value): number

- The function "addFirst" adds a value to the beginning of an array.

  #### Parameters

  - ##### value: T

    The value parameter represents the value that you want to add to the beginning of the array.

  #### Returns number

  The return value of the `addFirst` function is the new length of the array `_nodes` after adding the `value` at the beginning.

  - Defined in src/data-structures/queue/deque.ts:217

### addLast

- addLast(value): number

- The function "addLast" adds a value to the end of an array.

  #### Parameters

  - ##### value: T

    The value parameter represents the value that you want to add to the end of the array.

  #### Returns number

  The return value is the new length of the array after the value has been added.

  - Defined in src/data-structures/queue/deque.ts:186

### get

- get(index): null | T

- The get function returns the element at the specified index in an array, or null if the index is out of bounds.

  #### Parameters

  - ##### index: number

    The index parameter is a number that represents the position of the element you want to retrieve from the array.

  #### Returns null | T

  The method is returning the element at the specified index in the `_nodes` array. If the element exists, it will be returned. If the element does not exist (i.e., the index is out of bounds), `null` will be returned.

  - Defined in src/data-structures/queue/deque.ts:249

### insert

- insert(index, value): T[]

- The insert function adds a value at a specified index in an array.

  #### Parameters

  - ##### index: number

    The index parameter specifies the position at which the value should be inserted in the array. It is a number that represents the index of the array where the value should be inserted. The index starts from 0, so the first element of the array has an index of 0, the second element has

  - ##### value: T

    The value parameter represents the value that you want to insert into the array at the specified index.

  #### Returns T[]

  The splice method returns an array containing the removed elements, if any. In this case, since no elements are being removed, an empty array will be returned.

  - Defined in src/data-structures/queue/deque.ts:275

### isEmpty

- isEmpty(): boolean

- The function checks if an array called "_nodes" is empty.

  #### Returns boolean

  The method `isEmpty()` is returning a boolean value. It returns `true` if the length of the `_nodes` array is 0, indicating that the array is empty. Otherwise, it returns `false`.

  - Defined in src/data-structures/queue/deque.ts:294

### peekFirst

- peekFirst(): null | T

- The `peekFirst` function returns the first element of an array or null if the array is empty.

  #### Returns null | T

  The function `peekFirst()` is returning the first element (`T`) of the `_nodes` array. If the array is empty, it will return `null`.

  - Defined in src/data-structures/queue/deque.ts:226

### peekLast

- peekLast(): null | T

- The `peekLast` function returns the last element of an array or null if the array is empty.

  #### Returns null | T

  The method `peekLast()` returns the last element of the `_nodes` array, or `null` if the array is empty.

  - Defined in src/data-structures/queue/deque.ts:234

### pollFirst

- pollFirst(): null | T

- The `pollFirst` function removes and returns the first element from an array, or returns null if the array is empty.

  #### Returns null | T

  The `pollFirst()` function returns the first element of the `_nodes` array, or `null` if the array is empty.

  - Defined in src/data-structures/queue/deque.ts:203

### pollLast

- pollLast(): null | T

- The function "pollLast" returns and removes the last element from an array, or returns null if the array is empty.

  #### Returns null | T

  The method `pollLast()` returns the last element of the `_nodes` array, or `null` if the array is empty.

  - Defined in src/data-structures/queue/deque.ts:194

### remove

- remove(index): T[]

- The remove function removes an element from an array at a specified index.

  #### Parameters

  - ##### index: number

    The index parameter specifies the position of the element to be removed from the array. It is a number that represents the index of the element to be removed.

  #### Returns T[]

  The method is returning an array containing the removed element.

  - Defined in src/data-structures/queue/deque.ts:285

### set

- set(index, value): T

- The set function assigns a value to a specific index in an array.

  #### Parameters

  - ##### index: number

    The index parameter is a number that represents the position of the element in the array that you want to set a new value for.

  - ##### value: T

    The value parameter represents the new value that you want to set at the specified index in the _nodes array.

  #### Returns T

  The value that is being set at the specified index in the `_nodes` array.

  - Defined in src/data-structures/queue/deque.ts:261

Generated using TypeDoc