Iterator
ProtectedIterator is used to iterate over any data holder
without being able to remove elements.
This class acts as a wrapper for any class that implements the
Iterator interface and wants to be protected.
public function ProtectedIterator(iterator:Iterator)
Constructs a new ProtectedIterator instance.
This iterator forwards all functionality to the wrapped passed-in
iterator, except the removal of the current element.
iterator | the iterator to protect |
| IllegalArgumentException | if the passed-in iterator
is null or undefined
|
public function hasNext(Void):BooleanReturns whether there are more elements to iterate over.
For any special functionality that may be performed refer to the wrapped iterator that has been passed-in on construction. This method simply delegates to the wrapped iterator.
true if there is a next element else false
public function next(Void)Returns the next element.
For any special functionality that may be performed refer to the wrapped iterator that has been passed-in on construction. This method simply delegates to the wrapped iterator.
the next element
| NoSuchElementException | if there is no next element |
public function remove(Void):Void
This method always throws an UnsupportedOperationException
because this method is not supported by this iterator and has the
duty to not let the removal of elements happen.
| UnsupportedOperationException |