Packagecom.ericfeminella.collections
Classpublic class CollectionIterator
ImplementsIterator

Concrete Iterator implementation which provides an API for iterating over an ICollectionView.


Example
The following is a basic CollectionIterator example:
 var collection:ICollectionView = new ArrayCollection( ["a","b","c"] );
 var it:Iterator = new CollectionIterator( collection );

 while ( it.hasNext() )
 {
	 trace( it.next(), it.position() );
 }
 // a, 0
 // b, 1
 // c, 2
          

See also

com.ericfeminella.collections.Iterator
mx.collections.ICollectionView
mx.collections.CursorBookmark
mx.collections.IViewCursor


Protected Properties
 PropertyDefined by
  collection : ICollectionView
Defines the ICollectionView instance
CollectionIterator
  cursor : IViewCursor
Defines the IViewCursor instance to the aggregate
CollectionIterator
  index : int
Contains the current indexed position in the collection
CollectionIterator
Public Methods
 MethodDefined by
  
CollectionIterator(collection:ICollectionView)
Instantiates a new CollectionIterator instance
CollectionIterator
  
hasNext():Boolean
Determines if there are elements remaining in the ICollectionView
CollectionIterator
  
next():*
Returns the next item in the ICollectionView
CollectionIterator
  
position():int
Determines the IViewCursor position of the ICollectionView
CollectionIterator
  
reset():void
Resets the IViewCursor to a zero based indexed position
CollectionIterator
  
setCollection(collection:ICollectionView):void
Sets the collection in which to iterate over
CollectionIterator
Property detail
collectionproperty
protected var collection:ICollectionView

Defines the ICollectionView instance

See also

mx.collections.ICollectionView
cursorproperty 
protected var cursor:IViewCursor

Defines the IViewCursor instance to the aggregate

See also

mx.collections.IViewCursor
indexproperty 
protected var index:int

Contains the current indexed position in the collection

Constructor detail
CollectionIterator()constructor
public function CollectionIterator(collection:ICollectionView)

Instantiates a new CollectionIterator instance

Parameters
collection:ICollectionView — collection in which to iterate over
Method detail
hasNext()method
public function hasNext():Boolean

Determines if there are elements remaining in the ICollectionView

Returns
Boolean — true if an element remains, false if not
next()method 
public function next():*

Returns the next item in the ICollectionView

Returns
*
position()method 
public function position():int

Determines the IViewCursor position of the ICollectionView

Returns
int — the current position of the aggreagate
reset()method 
public function reset():void

Resets the IViewCursor to a zero based indexed position

See also

mx.collections.CursorBookmark.FIRST
setCollection()method 
public function setCollection(collection:ICollectionView):void

Sets the collection in which to iterate over

Parameters
collection:ICollectionView — ICollectionView instance