範例
public
class
ClassA
implements
Iterator{
public Object
next() {
//...
}
public boolean
hasNext() {
next();
//...
}
public void
remove() {
//...
}
解決方案
重新考量所用的方法呼叫 next()