T
- type of iteratorpublic class ConcatenatedIterators<T>
extends java.lang.Object
implements java.util.Iterator<T>
This allows to iterate over several iterators one after the other in one iteration. It just provides a view and does no additional copying.
This class is not thread-safe!
Constructor and Description |
---|
ConcatenatedIterators(java.lang.Iterable<? extends java.util.Iterator<? extends T>> iterators)
Constructor.
|
ConcatenatedIterators(java.util.Iterator<? extends T>... iterators)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext()
Returns
true if the iteration has more elements. |
T |
next()
Returns the next element in the iteration.
|
@SafeVarargs public ConcatenatedIterators(java.util.Iterator<? extends T>... iterators)
iterators
- iterators to iterate overTypes.concat(Iterator[])
public ConcatenatedIterators(@NotNull java.lang.Iterable<? extends java.util.Iterator<? extends T>> iterators)
iterators
- iterators to iterate overTypes.concatIterators(Iterable)
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 elements