Package | com.ericfeminella.utils.iterators |
Class | public class CollectionIterator |
Implements | IIterator |
See also
Property | Defined by | ||
---|---|---|---|
collection : ICollectionView
Defines the ICollectionView aggregate object instance
| CollectionIterator | ||
cursor : IViewCursor
Defines the IViewCursor instance to the aggregate
| CollectionIterator |
Method | Defined by | ||
---|---|---|---|
CollectionIterator(collection:ICollectionView = null)
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 | ||
setAggregate(aggregate:Object = null):void
Sets the collection in which to iterate over
| CollectionIterator |
collection | property |
protected var collection:ICollectionView
Defines the ICollectionView aggregate object instance
cursor | property |
protected var cursor:IViewCursor
Defines the IViewCursor instance to the aggregate
CollectionIterator | () | constructor |
public function CollectionIterator(collection:ICollectionView = null)
Instantiates a new CollectionIterator instance
Parameterscollection:ICollectionView (default = null ) — collection in which to iterate over
|
var collection:ICollectionView = new ArrayCollection(["A","B","C"]); var it:IIterator = new CollectionIterator( collection ); while ( it.hasNext() ) { trace( it.next(), it.position()); } //outputs: //A, 0 //B, 1 //C, 2
hasNext | () | method |
public function hasNext():Boolean
Determines if there are elements remaining in the ICollectionView
Determines if there are elements remaining in the aggregate
ReturnsBoolean — true if an element remains, false if not
|
next | () | method |
public function next():*
Returns the next item in the ICollectionView
Retrieves the next element in the aggregate
Returns* — next element based on the current index
|
position | () | method |
public function position():int
Determines the IViewCursor position of the ICollectionView
Determines the position of the current element in the aggreagate
Returnsint — the current index of the aggreagate
|
reset | () | method |
public function reset():void
Resets the IViewCursor to a zero based indexed position
See also
setAggregate | () | method |
public function setAggregate(aggregate:Object = null):void
Sets the collection in which to iterate over
Sets the aggregate object in which to iterator over
Parametersaggregate:Object (default = null ) — aggregate instance
|