| Package | system.data.iterators |
| Class | public class ArrayIterator |
| Inheritance | ArrayIterator Object |
| Implements | Iterator |
| Subclasses | ArrayFieldIterator |
Array to an iterator.
Example :
import system.iterators.ArrayIterator ;
import system.Iterator ;
var ar:Array = ["item1", "item2", "item3", "item4"] ;
var it:Iterator = new ArrayIterator(ar) ;
while (it.hasNext())
{
trace (it.next()) ;
}
trace ("--- it reset") ;
it.reset() ;
while (it.hasNext())
{
trace (it.next() + " : " + it.key()) ;
}
trace ("--- it seek 2") ;
it.seek(2) ;
while (it.hasNext())
{
trace (it.next()) ;
}
trace ("---") ;
| Property | Defined By | ||
|---|---|---|---|
| _a : Array
current array
| ArrayIterator | ||
| _k : Number
current key
| ArrayIterator | ||
| Method | Defined By | ||
|---|---|---|---|
ArrayIterator(a:Array)
Creates a new ArrayIterator instance. | ArrayIterator | ||
hasNext():Boolean
Returns true if the iteration has more elements. | ArrayIterator | ||
key():*
Returns the current key of the internal pointer of the iterator (optional operation). | ArrayIterator | ||
next():*
Returns the next element in the iteration. | ArrayIterator | ||
remove():*
Removes from the underlying collection the last element returned by the iterator (optional operation). | ArrayIterator | ||
reset():void
Reset the internal pointer of the iterator (optional operation). | ArrayIterator | ||
seek(position:*):void
Changes the position of the internal pointer of the iterator (optional operation). | ArrayIterator | ||
| _a | property |
protected var _a:Arraycurrent array
| _k | property |
protected var _k:Numbercurrent key
| ArrayIterator | () | Constructor |
public function ArrayIterator(a:Array)Creates a new ArrayIterator instance.
Parametersa:Array — the array to enumerate with the iterator.
|
ArgumentError — If the the passed-in Array argument is 'null'.
|
| hasNext | () | method |
public function hasNext():Boolean
Returns true if the iteration has more elements.
Boolean — true if the iteration has more elements.
|
| key | () | method |
public function key():*Returns the current key of the internal pointer of the iterator (optional operation).
Returns* — the current key of the internal pointer of the iterator (optional operation).
|
| next | () | method |
public function next():*Returns the next element in the iteration.
Returns* — the next element in the iteration.
|
| remove | () | method |
public function remove():*Removes from the underlying collection the last element returned by the iterator (optional operation).
Returns* |
| reset | () | method |
public function reset():voidReset the internal pointer of the iterator (optional operation).
| seek | () | method |
public function seek(position:*):voidChanges the position of the internal pointer of the iterator (optional operation).
Parameters
position:* |