Interface org.as2lib.data.holder.Iterator

org.as2lib.core.BasicInterface
   +--org.as2lib.data.holder.Iterator

Description

Iterator is used to iterate over data holders.

An iterator is quite simple to use. 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 MyIterator("value1", "value2", "value3"); while (iterator.hasNext()) { trace(iterator.next()); }

Output:

   value1
   value2
   value3
 

Method Index

hasNext(), next(), remove()

Inherited from BasicInterface

toString()

Method Detail

hasNext

public function hasNext(Void):Boolean

Returns whether there is another element to iterate over.

Return

true if there is at least one element left to iterate over

next

public function next(Void)

Returns the next element.

Return

the next element

Throws

NoSuchElementExceptionif there is no next element

remove

public function remove(Void):Void

Removes the currently selected element from this iterator and from the data holder this iterator iterates over.

Throws

IllegalStateExceptionif you try to remove an element when none is selected
UnsupportedOperationExceptionif this method is not supported by the concrete implementation of this interface