Class: List

utils.List

new List()

A double linked list.

Properties:
Name Type Description
head ListItem | null
tail ListItem | null
size Number
Source:

Methods

(private) insert(ref, item) → {Boolean}

Insert item into the linked list.

Parameters:
Name Type Description
ref ListItem | null
item ListItem
Source:
Returns:
Type
Boolean

pop() → {ListItem}

Remove the last item in the list.

Source:
Returns:
Type
ListItem

push(item) → {Boolean}

Append an item to the linked list (sets new tail).

Parameters:
Name Type Description
item ListItem
Source:
Returns:
Type
Boolean

(private) remove(item) → {Boolean}

Remove item from the linked list.

Parameters:
Name Type Description
item ListItem
Source:
Returns:
Type
Boolean

replace(ref, item)

Replace an item in-place.

Parameters:
Name Type Description
ref ListItem
item ListItem
Source:

reset()

Reset the cache. Clear all items.

Source:

shift() → {ListItem}

Remove the first item in the list.

Source:
Returns:
Type
ListItem

slice(totalnullable) → {Array:.<ListItem:>}

Slice the list to an array of items. Will remove the items sliced.

Parameters:
Name Type Attributes Description
total Number <nullable>
Source:
Returns:
Type
Array:.<ListItem:>

toArray() → {Array:.<ListItem:>}

Convert the list to an array of items.

Source:
Returns:
Type
Array:.<ListItem:>

unshift(item) → {Boolean}

Prepend an item to the linked list (sets new head).

Parameters:
Name Type Description
item ListItem
Source:
Returns:
Type
Boolean