Packagesystem.data.iterators
Classpublic class VectorIterator
InheritanceVectorIterator Inheritance Object
Implements Iterator

Converts a 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 ("---") ;
     



Protected Properties
 PropertyDefined By
  _k : int
The current iterator key.
VectorIterator
  _v : *
The current Vector reference
VectorIterator
Public Methods
 MethodDefined 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
Property Detail
_kproperty
protected var _k:int

The current iterator key.

_vproperty 
protected var _v:*

The current Vector reference

Constructor Detail
VectorIterator()Constructor
public function VectorIterator(vector:*)

Creates a new VectorIterator instance.

Parameters
vector:* — the Vector to enumerate with the iterator.

Throws
ArgumentError — If the the passed-in vector argument is 'null'.
 
ArgumentError — If the the passed-in vector argument is not a Vector.
Method Detail
hasNext()method
public function hasNext():Boolean

Returns true if the iteration has more elements.

Returns
Booleantrue 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():void

Reset the internal pointer of the iterator (optional operation).

seek()method 
public function seek(position:*):void

Changes the position of the internal pointer of the iterator (optional operation).

Parameters

position:*