LinkedList

LinkedList

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

Constructor

new LinkedList()

Source:

Members

size

Return number of elements in the list
Source:

Methods

(static) testInfiniteLoop(first)

Throw an error if circular loop detected in the linked list
Source:
Parameters:
Name Type Description
first LinkedListElement element to start iteration

append(element) → {LinkedList}

Append new element to the end of the list
Source:
Parameters:
Name Type Description
element LinkedListElement
Returns:
Type:
LinkedList

insert(newElement, elementBefore) → {LinkedList}

Insert new element to the list after elementBefore
Source:
Parameters:
Name Type Description
newElement LinkedListElement
elementBefore LinkedListElement
Returns:
Type:
LinkedList

isEmpty() → {boolean}

Return true if list is empty
Source:
Returns:
Type:
boolean

remove(element) → {LinkedList}

Remove element from the list
Source:
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:
Returns:
Type:
Array