LinkedList
LinkedList: represents a (singly, non-circular) linked list.
Constructor Summary
| Public Constructor | ||
| public |
|
|
Member Summary
| Public Members | ||
| public |
head: * |
|
Method Summary
| Public Methods | ||
| public |
|
|
| public |
Returns the count of the number of nodes in the list |
|
| public |
Return the head node of the linked list. |
|
| public |
getLastNode(): Node Retrieves the final element in the list. |
|
| public |
getNodeAtIndex(index: *): Node Retrieves the node found at the provided index. |
|
| public |
Inserts a new Node with element value at specified position LinkedList. |
|
| public |
Returns true if the list contains zero nodes. |
|
| public |
Sets the node at the head of the LinkedList to the node provided. |
|
Public Constructors
public constructor source
Public Members
public head: * source
Public Methods
public append(creates: element): void source
Params:
| Name | Type | Attribute | Description |
| creates | element | a new Node with element as value and appends to end of LinkedList |
Return:
| void |
public getNodeAtIndex(index: *): Node source
Retrieves the node found at the provided index. If index is out of range or list is empty, returns undefined.
Params:
| Name | Type | Attribute | Description |
| index | * | {Number} position in LinkedList at which to retrieve the node. |
public insert(index: *, creates: element): void source
Inserts a new Node with element value at specified position LinkedList. Index begins at 0.
Params:
| Name | Type | Attribute | Description |
| index | * | {Number} position in LinkedList at which to insert new element |
|
| creates | element | a new Node with element as value and appends to end of LinkedList |
Return:
| void |