# Class ArrayDeque<E>

#### Type Parameters

- #### E

#### 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<E>(): ArrayDeque<E>

- #### Type Parameters

  - #### E

  #### Returns ArrayDeque<E>

## Properties

### `Protected` _nodes

_nodes: E[] = []

- 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: E

    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: E

    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 | E

- 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 | E

  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): E[]

- 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: E

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

  #### Returns E[]

  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 | E

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

  #### Returns null | E

  The function `peekFirst()` is returning the first element (`E`) 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 | E

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

  #### Returns null | E

  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 | E

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

  #### Returns null | E

  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 | E

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

  #### Returns null | E

  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): E[]

- 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 E[]

  The method is returning an array containing the removed element.

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

### set

- set(index, value): E

- 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: E

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

  #### Returns E

  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