Package htsjdk.samtools.util
Class MergingIterator<T>
java.lang.Object
htsjdk.samtools.util.MergingIterator<T>
- All Implemented Interfaces:
CloseableIterator<T>
,Closeable
,AutoCloseable
,Iterator<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
ConstructorsConstructorDescriptionMergingIterator
(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
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 Details
-
MergingIterator
Creates a MergingIterator over the given Collection of iterators whose elements will be returned in the order defined by the given Comparator.
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-
remove
public void remove()Unsupported. -
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>
-