public class NestedIterator<E>
extends java.lang.Object
implements java.util.Iterator<E>
Iterator
interface
for iterating multiple collections as if it was one big collection.Modifier and Type | Field and Description |
---|---|
private java.util.Collection<? extends E>[] |
collections
The array to iterate.
|
private java.util.Iterator<? extends E> |
current
The current iterator.
|
private int |
index
The index of the next collection to return.
|
Constructor and Description |
---|
NestedIterator(java.util.Collection<? extends E>... collections)
Create a new
ArrayIterator object. |
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext() |
E |
next() |
void |
remove()
This operation is not supported.
|
private final java.util.Collection<? extends E>[] collections
private int index
private java.util.Iterator<? extends E> current
@SafeVarargs public NestedIterator(java.util.Collection<? extends E>... collections)
ArrayIterator
object.collections
- An array of Collection objects.