DListIterator

DListIterator

A doubly linked list iterator.

Provides some additional methods useful when dealing with linked lists.  Be careful when using them together with the methods implemented through the Iterator interface since they both work differently.

Summary
DListIteratorA doubly linked list iterator.
Variables
nodeThe node the iterator is currently pointing to.
listThe list this iterator uses.
Functions
DListIteratorCreates a new DListIterator instance pointing to a given node.
start@inheritDoc
next@inheritDoc
hasNext@inheritDoc
Properties
data@inheritDoc
data@private
Functions
endMoves the iterator to the tail node.
forthMoves the iterator to the next node.
backMoves the iterator to the previous node.
validChecks if the current referenced node is valid.
removeRemoves the node the iterator is pointing to.
toStringPrints out a string representing the current object.

Variables

node

public var node: DListNode

The node the iterator is currently pointing to.

list

public var list: DLinkedList

The list this iterator uses.

Functions

DListIterator

public function DListIterator(list: DLinkedList,  
node: DListNode = null)

Creates a new DListIterator instance pointing to a given node.  Usually created by invoking DLinkedList.getIterator().

Parameters

listThe linked list the iterator should handle.
nodeThe iterator’s starting node. 

start

public function start():void

@inheritDoc

next

public function next():*

@inheritDoc

hasNext

public function hasNext():Boolean

@inheritDoc

Properties

data

public function get data():*

@inheritDoc

data

public function set data(obj: *):void

@private

Functions

end

public function end():void

Moves the iterator to the tail node.

forth

public function forth():void

Moves the iterator to the next node.

back

public function back():void

Moves the iterator to the previous node.

valid

public function valid():Boolean

Checks if the current referenced node is valid.

Returns

True if the node exists, otherwise false. 

remove

public function remove():Boolean

Removes the node the iterator is pointing to.

Returns

True if the removal succeeded, otherwise false. 

toString

public function toString():String

Prints out a string representing the current object.

Returns

A string representing the current object. 

A ‘java-style’ iterator interface.
public var node: DListNode
The node the iterator is currently pointing to.
public var list: DLinkedList
The list this iterator uses.
public function DListIterator(list: DLinkedList,  
node: DListNode = null)
Creates a new DListIterator instance pointing to a given node.
public function start():void
@inheritDoc
public function next():*
@inheritDoc
public function hasNext():Boolean
@inheritDoc
public function get data():*
@inheritDoc
public function end():void
Moves the iterator to the tail node.
public function forth():void
Moves the iterator to the next node.
public function back():void
Moves the iterator to the previous node.
public function valid():Boolean
Checks if the current referenced node is valid.
public function remove():Boolean
Removes the node the iterator is pointing to.
public function toString():String
Prints out a string representing the current object.
Close