| Package | system.data.iterators |
| Class | public class VectorIterator |
| Inheritance | VectorIterator Object |
| Implements | Iterator |
Vector to an iterator.
Example :
import system.iterators.VectorIterator ;
import system.Iterator ;
var ve:Vector.<String> = new Vector.<String>() ;
ve[0] = "item1" ;
ve[1] = "item2" ;
ve[2] = "item3" ;
var it:VectorIterator = new VectorIterator(ve) ;
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()) ; // item3
}
trace ("---") ;
| Property | Defined By | ||
|---|---|---|---|
| _k : int
The current iterator key. | VectorIterator | ||
| _v : *
The current Vector reference
| VectorIterator | ||
| Method | Defined By | ||
|---|---|---|---|
VectorIterator(vector:*)
Creates a new VectorIterator instance. | VectorIterator | ||
hasNext():Boolean
Returns true if the iteration has more elements. | VectorIterator | ||
key():*
Returns the current key of the internal pointer of the iterator (optional operation). | VectorIterator | ||
next():*
Returns the next element in the iteration. | VectorIterator | ||
remove():*
Removes from the underlying collection the last element returned by the iterator (optional operation). | VectorIterator | ||
reset():void
Reset the internal pointer of the iterator (optional operation). | VectorIterator | ||
seek(position:*):void
Changes the position of the internal pointer of the iterator (optional operation). | VectorIterator | ||
| _k | property |
protected var _k:intThe current iterator key.
| _v | property |
protected var _v:*The current Vector reference
| VectorIterator | () | Constructor |
public function VectorIterator(vector:*)Creates a new VectorIterator instance.
Parametersvector:* — the Vector to enumerate with the iterator.
|
ArgumentError — If the the passed-in vector argument is 'null'.
| |
ArgumentError — If the the passed-in vector argument is not a Vector.
|
| 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:* |