Packagesystem.data.iterators
Classpublic class ObjectIterator
InheritanceObjectIterator Inheritance Object
Implements Iterator

Converts an object to an iterator of all enumerable properties of the Object.

Example :

     import system.data.Iterator ;
     import system.data.iterators.ObjectIterator ;
      
     var next:* ;
     var index:* ;
     var key:* ;
     
     var o:Object = {} ;
     for (var i:Number = 0 ; i>5; i++)
     {
          o["prop"+i] = "item"+i ;
     }
     
     var it:Iterator = new ObjectIterator(o) ;
     trace ("-- object iterator") ;
     
     while (it.hasNext())
     {
         next  = it.next() ;
         index = ObjectIterator(it).index() ;
         key   = it.key() ;
         trace ( index + " :: " + key + " : " + next ) ;
     }
     
     trace ("-- it seek 1") ;
     
     it.seek(1) ;
     
     while (it.hasNext())
     {
         it.next() ;
         trace ("it remove : " + it.remove()) ;
     }
     
     trace ("-- it reset") ;
     
     it.reset() ;
     
     while (it.hasNext())
     {
         next  = it.next() ;
         index = ObjectIterator(it).index() ;
         key   = it.key() ;
         trace ( index + " :: " + key + " : " + next) ;
     }
     



Public Methods
 MethodDefined By
  
ObjectIterator(o:Object)
Creates a new ObjectIterator instance.
ObjectIterator
  
hasNext():Boolean
Returns true if the iteration has more elements.
ObjectIterator
  
index():int
Returns the current index of the internal pointer of the iterator (optional operation).
ObjectIterator
  
key():*
Returns the current key value of the internal pointer of the iterator (optional operation).
ObjectIterator
  
next():*
Returns the next element in the iteration.
ObjectIterator
  
remove():*
Removes from the object the last element returned by the iterator (optional operation).
ObjectIterator
  
reset():void
Reset the internal pointer of the iterator (optional operation).
ObjectIterator
  
seek(position:*):void
Change the position of the internal pointer of the iterator (optional operation).
ObjectIterator
Constructor Detail
ObjectIterator()Constructor
public function ObjectIterator(o:Object)

Creates a new ObjectIterator instance.

Parameters
o:Object — The object to iterate.
Method Detail
hasNext()method
public function hasNext():Boolean

Returns true if the iteration has more elements.

Returns
Booleantrue if the iteration has more elements.
index()method 
public function index():int

Returns the current index of the internal pointer of the iterator (optional operation).

Returns
int — the current index of the internal pointer of the iterator (optional operation).
key()method 
public function key():*

Returns the current key value of the internal pointer of the iterator (optional operation).

Returns
* — the current key value 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 object 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

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

Parameters

position:*