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 TypeMethodDescriptionvoidaddIterator(Iterator<T> it) Add a collection.Get the current iterator.booleanhasNext()Returnstrueif the iteration has more elements.next()Returns the next element in the iteration.voidremove()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, waitMethods 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()Returnstrueif the iteration has more elements. (In other words, returnstrueifnext()would return an element rather than throwing an exception.) -
next
Returns the next element in the iteration.- Specified by:
nextin 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:
removein interfaceIterator<T>- Throws:
UnsupportedOperationException- if theremoveoperation is not supported by this iteratorIllegalStateException- if thenextmethod has not yet been called, or theremovemethod has already been called after the last call to thenextmethod
-
getCurrentIterator
Get the current iterator.
-