Package htsjdk.samtools.util
Class IterableOnceIterator<T>
- java.lang.Object
-
- htsjdk.samtools.util.IterableOnceIterator<T>
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterable<T>
,Iterator<T>
- Direct Known Subclasses:
SamLocusAndReferenceIterator
public abstract class IterableOnceIterator<T> extends Object implements Iterable<T>, Iterator<T>, Closeable
Abstract implementation of an iterator that also implements Iterable (to return itself) so that it can be used if for() loops. Only supports calling iterator() once since new iterators are not manufactured but the same object returned.
-
-
Constructor Summary
Constructors Constructor Description IterableOnceIterator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Does nothing, intended to be overridden when needed.Iterator<T>
iterator()
On the first call returns this object which is also an iterator.void
remove()
Operation not supported.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next
-
-
-
-
Method Detail
-
iterator
public Iterator<T> iterator()
On the first call returns this object which is also an iterator. On subsequent calls throws an exception since new iterators cannot be generated.
-
close
public void close() throws IOException
Does nothing, intended to be overridden when needed.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-