?? forwarditerator.java
字號:
package com.javapatterns.iterator.copsandsales;
public class ForwardIterator implements Iterator
{
public ForwardIterator(ShoppingCart anObj)
{
obj = anObj;
}
public void first()
{
state = 0;
}
public void next()
{
if (!isDone())
{
state++;
}
}
public boolean isDone()
{
if (state>obj.count() - 1)
{
return true;
}
return false;
}
public Object currentItem()
{
return obj.currentItem(state);
}
private int state;
private ShoppingCart obj;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -