Class MergeIterator<T>
- java.lang.Object
-
- org.apache.druid.java.util.common.guava.MergeIterator<T>
-
- All Implemented Interfaces:
Iterator<T>
public class MergeIterator<T> extends Object implements Iterator<T>
Iterator that merges a collection of sorted iterators using a comparator. Similar to Guava's MergingIterator, but avoids calling next() on any iterator prior to returning the value returned by the previous call to next(). This is important when merging iterators that reuse container objects across calls to next(). Used byUtils.mergeSorted(Iterable, Comparator)
.
-
-
Constructor Summary
Constructors Constructor Description MergeIterator(Iterable<? extends Iterator<? extends T>> sortedIterators, Comparator<? super T> comparator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
T
next()
void
remove()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
MergeIterator
public MergeIterator(Iterable<? extends Iterator<? extends T>> sortedIterators, Comparator<? super T> comparator)
-
-