public class MultiIterator<T>
extends java.lang.Object
implements java.util.Iterator<T>
Modifier and Type | Field and Description |
---|---|
protected int |
collcnt
The counter for the collection.
|
protected java.util.Iterator<T> |
curit
The current iterator.
|
protected java.util.List<java.util.Iterator<T>> |
its
The data collections.
|
Constructor and Description |
---|
MultiIterator()
Create a new MultiCollectionIterator.
|
Modifier and Type | Method and Description |
---|---|
void |
addIterator(java.util.Iterator<T> it)
Add a collection.
|
protected java.util.Iterator<T> |
getCurrentIterator()
Get the current iterator.
|
boolean |
hasNext()
Returns
true if the iteration has more elements. |
T |
next()
Returns the next element in the iteration.
|
void |
remove()
Removes from the underlying collection the last element returned
by this iterator (optional operation).
|
protected java.util.List<java.util.Iterator<T>> its
protected int collcnt
protected java.util.Iterator<T> curit
public void addIterator(java.util.Iterator<T> it)
coll
- The collection.public boolean hasNext()
true
if the iteration has more elements.
(In other words, returns true
if next()
would
return an element rather than throwing an exception.)hasNext
in interface java.util.Iterator<T>
true
if the iteration has more elementspublic T next()
next
in interface java.util.Iterator<T>
java.util.NoSuchElementException
- if the iteration has no more elementspublic void remove()
next()
. 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.remove
in interface java.util.Iterator<T>
java.lang.UnsupportedOperationException
- if the remove
operation is not supported by this iteratorjava.lang.IllegalStateException
- if the next
method has not
yet been called, or the remove
method has already
been called after the last call to the next
methodprotected java.util.Iterator<T> getCurrentIterator()