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:
depristo 2009-04-30 22:15:14 +00:00
parent 12d6edfe7c
commit ff420f5f6f
1 changed files with 5 additions and 1 deletions

View File

@ -11,7 +11,7 @@ package org.broadinstitute.sting.gatk.iterators;
import java.util.Iterator;
public class PushbackIterator<T> implements Iterator<T> {
public class PushbackIterator<T> implements Iterator<T>, Iterable<T> {
Iterator<T> underlyingIterator;
T pushedElement = null;
@ -23,6 +23,10 @@ public class PushbackIterator<T> implements Iterator<T> {
return pushedElement != null || underlyingIterator.hasNext();
}
public Iterator<T> iterator() {
return this;
}
public T peek() {
T x = next();
pushback(x);