Enabled iterator() function
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@575 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
12d6edfe7c
commit
ff420f5f6f
|
|
@ -11,7 +11,7 @@ package org.broadinstitute.sting.gatk.iterators;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
public class PushbackIterator<T> implements Iterator<T> {
|
public class PushbackIterator<T> implements Iterator<T>, Iterable<T> {
|
||||||
Iterator<T> underlyingIterator;
|
Iterator<T> underlyingIterator;
|
||||||
T pushedElement = null;
|
T pushedElement = null;
|
||||||
|
|
||||||
|
|
@ -23,6 +23,10 @@ public class PushbackIterator<T> implements Iterator<T> {
|
||||||
return pushedElement != null || underlyingIterator.hasNext();
|
return pushedElement != null || underlyingIterator.hasNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Iterator<T> iterator() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public T peek() {
|
public T peek() {
|
||||||
T x = next();
|
T x = next();
|
||||||
pushback(x);
|
pushback(x);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue