Java tutorial
/* * Copyright Javelin Software, All rights reserved. */ import java.util.*; /** * An EmptyIterator. * * @author Robin Sharp */ public class EmptyIterator implements Iterator { public static Iterator getInstance() { return iterator; } /** * @return false; */ public boolean hasNext() { return false; } /** * @return null */ public Object next() { throw new NoSuchElementException(); } /** * No-op */ public void remove() { throw new UnsupportedOperationException(); } protected static Iterator iterator = new EmptyIterator(); }