Class: LinkedListIterator

js_cols.LinkedList. LinkedListIterator

new LinkedListIterator(startpos, list)

A Linked List Iterator used to traverse and modify elements in a Linked List,

Parameters:
Name Type Description
startpos Integer

the start position of this Iterator

list js_cols.LinkedList

the list to iterate

Methods

add(element)

Inserts a new element after the current position, and moves the Iterator forward to this new elemnt

Parameters:
Name Type Description
element *

the new element to insert

hasNext() → {Boolean}

Checks if the iterator has a next element

Returns:
Type
Boolean

hasPrevious() → {Boolean}

Checks if the iterator has a previous element

Returns:
Type
Boolean

next() → {*}

Moves the Iterator 1 step forward, and returns the new element reached

Returns:

the new element reached

Type
*

previous() → {*}

Moves the Iterator 1 step backwards, and returns the new element reached

Returns:

the new element reached

Type
*

remove() → {*}

Removes the element at the current position, and moves the Iterator to the previous element

Returns:

the removed element

Type
*

set(element)

Replaces the element at the current position

Parameters:
Name Type Description
element *

the new element to replace the current position

js_cols - powerful collection classes for JavaScript
js_cols Copyright © 2010-2015 Thomas Stjernegaard Jeppesen.
Documentation generated by JSDoc 3.3.0-alpha13 on Sat Dec 27th 2014 using the DocStrap template.