| Package | com.ericfeminella.utils.iterators |
| Class | public class ArrayIterator |
| Implements | IIterator |
| Method | Defined by | ||
|---|---|---|---|
|
ArrayIterator(array:Array = null)
Instantiates a new ArrayIterator instance
| ArrayIterator | ||
|
hasNext():Boolean
Determines if there are elements remaining in the aggregate
| ArrayIterator | ||
|
next():*
Returns the next item element in the array
| ArrayIterator | ||
|
position():int
Determines the indexed position of the aggreagate
| ArrayIterator | ||
|
reset():void
Resets the index of the ArrayIterator instance to 0
| ArrayIterator | ||
|
setAggregate(aggregate:Object = null):void
Sets the array in which the ArrayIterator instance is
to iterator over
| ArrayIterator | ||
| ArrayIterator | () | constructor |
public function ArrayIterator(array:Array = null)Instantiates a new ArrayIterator instance
Parametersarray:Array (default = null) — Array in which to iterate over
|
var array:Array = new Array("A","B","C");
var it:IIterator = new ArrayIterator( array );
while ( it.hasNext() )
{
trace( it.next(), it.position());
}
//outputs:
//A, 0
//B, 1
//C, 2
| hasNext | () | method |
public function hasNext():BooleanDetermines if there are elements remaining in the aggregate
Determines if there are elements remaining in the aggregate
ReturnsBoolean — 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():intDetermines the indexed position of the aggreagate
Determines the position of the current element in the aggreagate
Returnsint — the current index of the aggreagate
|
| reset | () | method |
public function reset():voidResets the index of the ArrayIterator instance to 0
| setAggregate | () | method |
public function setAggregate(aggregate:Object = null):voidSets the array in which the ArrayIterator instance is to iterator over
Sets the aggregate object in which to iterator over
Parametersaggregate:Object (default = null) — aggregate instance
|