net.sf.eos.trie
Class EmptyIterator
java.lang.Object
net.sf.eos.trie.UnmodifiableIterator
net.sf.eos.trie.EmptyIterator
- All Implemented Interfaces:
- Iterator
public class EmptyIterator
- extends UnmodifiableIterator
Provides an unmodifiable empty iterator. EmptyIterator
always
returns that there aren't any more items and throws a
NoSuchElementException
when attempting to move to the next item.
try{
EmptyIterator ei = new EmptyIterator();
ei.next();
} catch (Exception e) {
System.out.println("Expected to get NoSuchElementException exception: " + e.toString());
}
Output:
Expected to get NoSuchElementException exception: java.util.NoSuchElementException
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EMPTY_ITERATOR
public static final Iterator EMPTY_ITERATOR
- A constant EmptyIterator.
EmptyIterator
public EmptyIterator()
emptyIterator
public static <T> Iterator<T> emptyIterator()
hasNext
public boolean hasNext()
next
public Object next()
Copyright © 2008. All Rights Reserved.