Chain

Basic chained data structure. Essentially a linked list.

Constructor

new Chain(items)

Create a new Chain.
Parameters:
NameTypeDescription
itemsArray.<any>(Optional) Items to add

Methods

addBack(item)

Add an item to the end of the Chain.
Parameters:
NameTypeDescription
itemanyItem to add

addFront(item)

Add an item to the beginning of the Chain.
Parameters:
NameTypeDescription
itemanyItem to add

clear()

Remove all items from the Chain.

popBack()

Remove and return the last item in the Chain.
Returns:
Removed item

popFront()

Remove and return the first item in the Chain.
Returns:
Removed item

removeBack()

Remove the last item in the Chain.

removeFront()

Remove the first item in the Chain.