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
public class PeekableIterator<Object> extends Object implements CloseableIterator<Object>
Generic Closable Iterator that allows you to peek at the next value before calling next
-
-
Constructor Summary
Constructors Constructor Description PeekableIterator(Iterator<Object> iterator)
Constructs a new iterator that wraps the supplied iterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the underlying iterator.boolean
hasNext()
True if there are more items, in which case both next() and peek() will return a value.Object
next()
Returns the next object and advances the iterator.Object
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
-
-
-
-
Method Detail
-
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
public Object next()
Returns the next object and advances the iterator.
-
peek
public Object peek()
Returns the next object but does not advance the iterator. Subsequent calls to peek() and next() will return the same object.
-
-