htsjdk.samtools.util.DelegatingIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of htsjdk Show documentation
Show all versions of htsjdk Show documentation
A Java API for high-throughput sequencing data (HTS) formats
package htsjdk.samtools.util;
import java.util.Iterator;
/**
* Simple iterator class that delegates all method calls to an underlying iterator. Useful
* for in-line subclassing to add behaviour to one or more methods.
*
* @author Tim Fennell
*/
public class DelegatingIterator implements CloseableIterator {
private final Iterator iterator;
public DelegatingIterator(final Iterator iterator) {
this.iterator = iterator;
}
@Override
public void close() {
if (iterator instanceof CloseableIterator) {
((CloseableIterator) this.iterator).close();
}
}
@Override
public boolean hasNext() {
return this.iterator.hasNext();
}
@Override
public T next() {
return this.iterator.next();
}
@Override
public void remove() {
this.iterator.remove();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy