API Docs for: 1.0.0
Show:

LinkedListIterator Class

Iterator for LinkedList. Stable except when the next item is removed by calling list.remove() instead of iter.removeNext(). When items are inserted into an empty list, the pointer remains at the end, not the beginning.

Methods

atBeginning

() Boolean

Returns:

Boolean:

true if at the beginning

atEnd

() Boolean

Returns:

Boolean:

true if at the end

insert

(
  • value
)
LinkedListItem

Insert the given value at the iteration position. The inserted item will be returned by next().

Parameters:

  • value Mixed

    value to insert

Returns:

LinkedListItem:

inserted item

moveToBeginning

()

Move to the beginning of the list.

moveToEnd

()

Move to the end of the list.

next

() Mixed

Returns:

Mixed:

next value in the list or undefined if at the end

prev

() Mixed

Returns:

Mixed:

previous value in the list or undefined if at the beginning

removeNext

() LinkedListItem

Remove the next item from the list.

Returns:

LinkedListItem:

removed item or undefined if at the end

removePrev

() LinkedListItem

Remove the previous item from the list.

Returns:

LinkedListItem:

removed item or undefined if at the end