new ArrayIterator(array)
Converts a Array
to an iterator.
Parameters:
Name | Type | Description |
---|---|---|
array |
array | The array to iterate. |
- Implements:
Throws:
ReferenceError If the passed-in argument is not an array.
Example
var ArrayIterator = system.data.iterators.ArrayIterator ; var ar = ["item1", "item2", "item3", "item4"] ; var it = new ArrayIterator(ar) ; 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()) ; } trace ("---") ;
Methods
-
delete()
-
Deletes from the underlying collection the last element returned by the iterator (optional operation).
- Implements:
-
hasNext()
-
Returns
true
if the iteration has more elements.- Implements:
Returns:
true
if the iteration has more elements. -
key()
-
Returns the current key of the internal pointer of the iterator (optional operation).
- Implements:
Returns:
the current key of the internal pointer of the iterator (optional operation).
-
next()
-
Returns the next element in the iteration.
- Implements:
Returns:
the next element in the iteration.
-
reset()
-
Reset the internal pointer of the iterator (optional operation).
- Implements:
-
seek()
-
Changes the position of the internal pointer of the iterator (optional operation).
- Implements: