Package jadex.collection
Class MultiIterator<T>
java.lang.Object
jadex.collection.MultiIterator<T>
- All Implemented Interfaces:
Iterator<T>
Iterator that operates over multiple collections.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addIterator
(Iterator<T> it) Add a collection.Get the current iterator.boolean
hasNext()
Returnstrue
if the iteration has more elements.next()
Returns the next element in the iteration.void
remove()
Removes from the underlying collection the last element returned by this iterator (optional operation).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
its
The data collections. -
collcnt
protected int collcntThe counter for the collection. -
curit
The current iterator.
-
-
Constructor Details
-
MultiIterator
public MultiIterator()Create a new MultiCollectionIterator.
-
-
Method Details
-
addIterator
Add a collection.- Parameters:
coll
- The collection.
-
hasNext
public boolean hasNext()Returnstrue
if the iteration has more elements. (In other words, returnstrue
ifnext()
would return an element rather than throwing an exception.) -
next
Returns the next element in the iteration.- Specified by:
next
in interfaceIterator<T>
- Returns:
- the next element in the iteration
- Throws:
NoSuchElementException
- if the iteration has no more elements
-
remove
public void remove()Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call tonext()
. The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.- Specified by:
remove
in interfaceIterator<T>
- Throws:
UnsupportedOperationException
- if theremove
operation is not supported by this iteratorIllegalStateException
- if thenext
method has not yet been called, or theremove
method has already been called after the last call to thenext
method
-
getCurrentIterator
Get the current iterator.
-