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.
Item Index
Methods
atBeginning
()
Boolean
Returns:
Boolean:
true if at the beginning
atEnd
()
Boolean
Returns:
Boolean:
true if at the end
insert
(
LinkedListItem
-
value
Insert the given value at the iteration position. The inserted item will be returned by next().
Parameters:
-
value
Mixedvalue 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