Class org.as2lib.data.holder.ProtectedIterator

org.as2lib.core.BasicClass
   +--org.as2lib.data.holder.ProtectedIterator

Implemented Interfaces

Iterator

Description

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.

Method Index

new ProtectedIterator()

hasNext(), next(), remove()

Inherited from BasicClass

toString()

Constructor Detail

ProtectedIterator

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.

Parameters

iteratorthe iterator to protect

Throws

IllegalArgumentExceptionif the passed-in iterator is null or undefined

Method Detail

hasNext

public function hasNext(Void):Boolean

Returns 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.

Return

true if there is a next element else false

Specified By

hasNext() in org.as2lib.data.holder.Iterator

next

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.

Return

the next element

Throws

NoSuchElementExceptionif there is no next element

Specified By

next() in org.as2lib.data.holder.Iterator

remove

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.

Throws

UnsupportedOperationException

Specified By

remove() in org.as2lib.data.holder.Iterator