Package htsjdk.samtools.util
Class PeekableIterator<Object>
java.lang.Object
htsjdk.samtools.util.PeekableIterator<Object>
- All Implemented Interfaces:
CloseableIterator<Object>
,Closeable
,AutoCloseable
,Iterator<Object>
- Direct Known Subclasses:
SamPairUtil.SetMateInfoIterator
Generic Closable Iterator that allows you to peek at the next value before calling next
-
Constructor Summary
ConstructorsConstructorDescriptionPeekableIterator
(Iterator<Object> iterator) Constructs a new iterator that wraps the supplied iterator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the underlying iterator.boolean
hasNext()
True if there are more items, in which case both next() and peek() will return a value.next()
Returns the next object and advances the iterator.peek()
Returns the next object but does not advance the iterator.void
remove()
Unsupported Operation.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
-
PeekableIterator
Constructs a new iterator that wraps the supplied iterator.
-
-
Method Details
-
close
public void close()Closes the underlying iterator.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceCloseableIterator<Object>
-
hasNext
public boolean hasNext()True if there are more items, in which case both next() and peek() will return a value. -
next
Returns the next object and advances the iterator. -
peek
Returns the next object but does not advance the iterator. Subsequent calls to peek() and next() will return the same object. -
remove
public void remove()Unsupported Operation.
-