Home Reference Source
public class | source

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

append(creates: element): void

public

Returns the count of the number of nodes in the list

public

Return the head node of the linked list.

public

Retrieves the final element in the list.

public

getNodeAtIndex(index: *): Node

Retrieves the node found at the provided index.

public

insert(index: *, creates: element): void

Inserts a new Node with element value at specified position LinkedList.

public

isEmpty(element: *): Boolean

Returns true if the list contains zero nodes.

public

setHead(value: Node): void

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:

NameTypeAttributeDescription
creates element

a new Node with element as value and appends to end of LinkedList

Return:

void

public count(): Number source

Returns the count of the number of nodes in the list

Return:

Number

public getHead(): Node source

Return the head node of the linked list.

Return:

Node

true if any vertex has this value else false

public getLastNode(): Node source

Retrieves the final element in the list.

Return:

Node

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:

NameTypeAttributeDescription
index *

{Number} position in LinkedList at which to retrieve the node.

Return:

Node

public insert(index: *, creates: element): void source

Inserts a new Node with element value at specified position LinkedList. Index begins at 0.

Params:

NameTypeAttributeDescription
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

public isEmpty(element: *): Boolean source

Returns true if the list contains zero nodes.

Params:

NameTypeAttributeDescription
element *

Return:

Boolean

public setHead(value: Node): void source

Sets the node at the head of the LinkedList to the node provided.

Params:

NameTypeAttributeDescription
value Node

to find in the graph.

Return:

void