LinkedList

clay.core. LinkedList

# new LinkedList()

Source:

Simple double linked list. Compared with array, it has O(1) remove operation.

Classes

Entry

Members

Source:
Type:

# tail :clay.core.LinkedList.Entry

Source:
Type:

Methods

# clear()

Source:

Clear the list

# forEach(cb, context)

Source:
Parameters:
Name Type Description
cb function
context

# getAt(idx)

Source:

Get value at idx

Parameters:
Name Type Description
idx number
Returns:

# getHead()

Source:

Get head value

Returns:

# getTail()

Source:

Get tail value

Returns:

# indexOf(value) → {number}

Source:
Parameters:
Name Type Description
value
Returns:
Type
number

# insert(val) → {clay.core.LinkedList.Entry}

Source:

Insert a new value at the tail

Parameters:
Name Type Description
val
Returns:
Type
clay.core.LinkedList.Entry

# insertAt(idx, val) → {clay.core.LinkedList.Entry}

Source:

Insert a new value at idx

Parameters:
Name Type Description
idx number
val
Returns:
Type
clay.core.LinkedList.Entry

# insertEntry(entry)

Source:

Insert an entry at the tail

Parameters:
Name Type Description
entry clay.core.LinkedList.Entry

# isEmpty()

Source:

If list is empty

# length() → {number}

Source:
Returns:
Type
number

# remove(entry)

Source:

Remove entry.

Parameters:
Name Type Description
entry clay.core.LinkedList.Entry

# removeAt(idx)

Source:

Remove entry at index.

Parameters:
Name Type Description
idx number
Returns: