iterator.java

来自「BOOK:Beginning Algorithms Code Example」· Java 代码 · 共 51 行

JAVA
51
字号
package com.wrox.algorithms.iteration;/** * Iterator based on that defined in Design Patterns (Gamma et. al). * */public interface Iterator {    /**     * (Re)positions the iterator to the first item.     *     * @throws UnsupportedOperationException if not implemented.     */    public void first();    /**     * (Re)positions the iterator to the last item.     *     * @throws UnsupportedOperationException if not implemented.     */    public void last();    /**     * Checks to see if the iterator refers to an item.     *     * @return <code>true</code> if the end has been reached; otherwise <code>false</code>.     */    public boolean isDone();    /**     * Positions to the next item.     *     * @throws UnsupportedOperationException if not implemented.     */    public void next();    /**     * Positions to the previous item.     *     * @throws UnsupportedOperationException if not implemented.     */    public void previous();    /**     * Obtains the value of the current item.     *     * @return The value of the current item.     * @throws IteratorOutOfBoundsException if there is no current item.     */    public Object current() throws IteratorOutOfBoundsException;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?