Package htsjdk.samtools.util
Class MergingIterator<T>
- java.lang.Object
-
- htsjdk.samtools.util.MergingIterator<T>
-
- All Implemented Interfaces:
CloseableIterator<T>
,Closeable
,AutoCloseable
,Iterator<T>
public class MergingIterator<T> extends Object implements CloseableIterator<T>
An iterator over Iterators that return Ts. Calling next() returns the next T ordered according to Comparator provided at construction time. Importantly, the elements in the input Iterators must already be sorted according to the provided Comparator.
-
-
Constructor Summary
Constructors Constructor Description MergingIterator(Comparator<T> comparator, Collection<CloseableIterator<T>> iterators)
Creates a MergingIterator over the given Collection of iterators whose elements will be returned in the order defined by the given Comparator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes every CloseableIterator in this MergingIterator.boolean
hasNext()
T
next()
void
remove()
Unsupported.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface htsjdk.samtools.util.CloseableIterator
stream, toList
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
MergingIterator
public MergingIterator(Comparator<T> comparator, Collection<CloseableIterator<T>> iterators)
Creates a MergingIterator over the given Collection of iterators whose elements will be returned in the order defined by the given Comparator.
-
-
Method Detail
-
close
public void close()
Closes every CloseableIterator in this MergingIterator. After calling, calls to hasNext() will always return false.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceCloseableIterator<T>
-
-