⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 emptyiterator.java

📁 BOOK:Beginning Algorithms Code Examples
💻 JAVA
字号:
package com.wrox.algorithms.iteration;/** * An {@link Iterator} where {@link #isDone()} always returns <code>true</code>. * */public final class EmptyIterator implements Iterator {    /** The single, publicly accessible, instance of the comparator. */    public static final EmptyIterator INSTANCE = new EmptyIterator();    /**     * Constructor marked private to prevent instantiation.     */    private EmptyIterator() {        // Nothing to do    }    public void first() {        // Nothing to do    }    public void last() {        // Nothing to do    }    public boolean isDone() {        // We're always done!        return true;    }    public void next() {        // Nothing to do    }    public void previous() {        // Nothing to do    }    public Object current() throws IteratorOutOfBoundsException {        throw new IteratorOutOfBoundsException();    }}

⌨️ 快捷键说明

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