lineariterator.java
来自「国外的数据结构与算法分析用书」· Java 代码 · 共 37 行
JAVA
37 行
package simple;
/** A basic iterator interface for moving through a collection of items linearly.
It utilizes a cursor to keep track of the current item in the sequence. It
has methods to move to the front of the collection and to move forward. */
public interface LinearIterator
{
/** Is there a current item? */
public boolean itemExists();
/** The current item.
PRECONDITION:
itemExists() */
public Object item() throws NoCurrentItemUosException;
/** Is the current position before the start of the structure? */
public boolean before();
/** Is the current position after the end of the structure? */
public boolean after();
/** Go to the first item in the structure. */
public void goFirst();
/** Advance one item in the data structure.
PRECONDITION:
!after() */
public void goForth() throws AfterTheEndUosException;
/** Move to the position prior to the first element in the structure. */
public void goBefore();
/** Move to the position after the last element in the structure. */
public void goAfter();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?