public class NestedIterator<E> extends Object implements Iterator<E>
Iterator
interface
for iterating multiple collections as if it was one big collection.Modifier and Type | Field and Description |
---|---|
private Collection<? extends E>[] |
collections
The array to iterate.
|
private Iterator<? extends E> |
current
The current iterator.
|
private int |
index
The index of the next collection to return.
|
Constructor and Description |
---|
NestedIterator(Collection<? extends E>... collections)
Create a new
ArrayIterator object. |
private final Collection<? extends E>[] collections
private int index
@SafeVarargs public NestedIterator(Collection<? extends E>... collections)
ArrayIterator
object.collections
- An array of Collection objects.public void remove()
remove
in interface Iterator<E>
UnsupportedOperationException
- Is always thrown