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
-
Method Summary
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
-
Constructor Details
-
IterableOnceIterator
public IterableOnceIterator()
-
-
Method Details
-
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. -
remove
public void remove()Operation not supported. -
close
Does nothing, intended to be overridden when needed.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-