Packagecom.ericfeminella.collections
Classpublic class ArrayIterator
ImplementsIterator

Concrete Iterator implementation which provides an API for iterating over an Array.


Example
A basic example is as follows:

var array:Array = new Array( "A", "B", "C" );
var it:Iterator = new ArrayIterator( array );

while ( it.hasNext() )
{
   trace( it.next(), it.position());
}
//outputs:
//A, 0
//B, 1
//C, 2
          

See also

com.ericfeminella.collections.Iterator


Public Methods
 MethodDefined by
  
ArrayIterator(array:Array = null)
Instantiates a new ArrayIterator instance
ArrayIterator
  
hasNext():Boolean
Determines if elements remain in the Array.
ArrayIterator
  
next():*
Returns the next item element in the Array.
ArrayIterator
  
position():int
Determines the indexed position of the Array.
ArrayIterator
  
reset():void
Resets the index of the ArrayIterator instance to 0.
ArrayIterator
Constructor detail
ArrayIterator()constructor
public function ArrayIterator(array:Array = null)

Instantiates a new ArrayIterator instance

Parameters
array:Array (default = null) — Array in which to iterate over
Method detail
hasNext()method
public function hasNext():Boolean

Determines if elements remain in the Array. Determines if there are elements remaining in the aggregate.

Returns
Boolean — true if an element remains, false if not
next()method 
public function next():*

Returns the next item element in the Array.

Returns
* — next array element based on the current index
position()method 
public function position():int

Determines the indexed position of the Array.

Returns
int
reset()method 
public function reset():void

Resets the index of the ArrayIterator instance to 0.