Package htsjdk.samtools.util
Class AbstractIterator<E>
- java.lang.Object
-
- htsjdk.samtools.util.AbstractIterator<E>
-
- All Implemented Interfaces:
Iterator<E>
- Direct Known Subclasses:
LineIteratorImpl
public abstract class AbstractIterator<E> extends Object implements Iterator<E>
Base class of implementing iterators. All you have to do is implement advance which gets the next element.
-
-
Constructor Summary
Constructors Constructor Description AbstractIterator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract E
advance()
boolean
hasNext()
protected boolean
isIterating()
E
next()
E
peek()
Returns the next element in the iterator, if one exists.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
-
-
-
-
Field Detail
-
next
protected E next
-
-
Method Detail
-
advance
protected abstract E advance()
- Returns:
- the next element or null if the iterator is at the end
-
peek
public E peek()
Returns the next element in the iterator, if one exists. Otherwise, returns null. Invoking this method does not advance the iterator.- Returns:
- The next element in the iterator, without advancing, or, if no other element exists, null.
-
isIterating
protected boolean isIterating()
- Returns:
- true after the first time hasNext() or next() have been called
-
-