import java.util.Iterator;
/**
* Adapt iterator to iterable
*
* @author Hong Hong
*
* @param Iterator type
*/
public class IteratorIterable implements Iterable, Iterator {
protected Iterator m_itr;
public IteratorIterable(Iterator itr) {
assert(itr != null);
m_itr = itr;
}
public Iterator iterator() {
return m_itr;
}
public boolean hasNext() {
return m_itr.hasNext();
}
public T next() {
return m_itr.next();
}
public void remove() {
m_itr.remove();
}
}