Access keys

ArrayIterator

Kind of class: class
Inherits from: BasicClass
Implements:
Author: Simon Wacker, Michael Herrmann, Martin Heidegger
Classpath: org.as2lib.data.holder.array.ArrayIterator
File last modified: Sunday, 18 September 2005, 21:24:20
ArrayIterator can be used to iterate over arrays.

The usage of this iterator is quite simple. There is one method to check
whether there are more elements left to iterate over hasNext, one method
to get the next element next and one to remove the current element
remove.

Example:

var iterator:Iterator = new ArrayIterator(["value1", "value2", "value3"]);
while (iterator.hasNext()) {
    trace(iterator.next());
}

Output:

value1
value2
value3

Summary

Constructor
Instance methods
Instance methods inherited from BasicClass

Constructor

ArrayIterator

function ArrayIterator (
target:Array)
Constructs a new ArrayIterator instance.
Parameters:
target:
the array to iterate over
Throws:
org.as2lib.env.except.IllegalArgumentException if the passed-in target array is
null or undefined

Instance methods

hasNext

function hasNext (
Void) : Boolean
Returns whether there exists another element to iterate over.
Returns:
true if there is at least one lement left to iterate over

next

function next (
Void)
Returns the next element of the array.
Returns:
the next element of the array
Throws:

remove

function remove (
Void) : Void
Removes the currently selected element from this iterator and from the array this
iterator iterates over.
Throws:
org.as2lib.env.except.IllegalStateException if you try to remove an element when none is selected