# LinkedList

Class implements bidirectional non-circular linked list.
LinkedListElement - object of any type that has properties next and prev.

## Constructor

#### new LinkedList()

Source:
  - data_structures/linked_list.js, line 7

### Members

#### size

Return number of elements in the list

Source:
  - data_structures/linked_list.js, line 27

### Methods

#### (static) testInfiniteLoop(first)

Throw an error if circular loop detected in the linked list

Source:
  - data_structures/linked_list.js, line 151

##### Parameters:

Name | Type | Description
--- | --- | ---
`first` | `LinkedListElement` | element to start iteration

##### Throws:

`Flatten.Errors.INFINITE_LOOP`

#### append(element) → {LinkedList}

Append new element to the end of the list

Source:
  - data_structures/linked_list.js, line 59

##### Parameters:

Name | Type | Description
--- | --- | ---
`element` | `LinkedListElement` |

##### Returns:

Type:
  `LinkedList`

#### insert(newElement, elementBefore) → {LinkedList}

Insert new element to the list after elementBefore

Source:
  - data_structures/linked_list.js, line 82

##### Parameters:

Name | Type | Description
--- | --- | ---
`newElement` | `LinkedListElement` |
`elementBefore` | `LinkedListElement` |

##### Returns:

Type:
  `LinkedList`

#### isEmpty() → {boolean}

Return true if list is empty

Source:
  - data_structures/linked_list.js, line 142

##### Returns:

Type:
  `boolean`

#### remove(element) → {LinkedList}

Remove element from the list

Source:
  - data_structures/linked_list.js, line 117

##### Parameters:

Name | Type | Description
--- | --- | ---
`element` | `LinkedListElement` |

##### Returns:

Type:
  `LinkedList`

#### toArray() → {Array}

Return array of elements from start to end, If start or end not defined, take first as start, last as end

Source:
  - data_structures/linked_list.js, line 40

##### Returns:

Type:
  `Array`