net.sf.eos.trie
Class EmptyIterator

java.lang.Object
  extended by net.sf.eos.trie.UnmodifiableIterator
      extended by 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
 


Field Summary
static Iterator EMPTY_ITERATOR
          A constant EmptyIterator.
 
Constructor Summary
EmptyIterator()
           
 
Method Summary
static
<T> Iterator<T>
emptyIterator()
           
 boolean hasNext()
           
 Object next()
           
 
Methods inherited from class net.sf.eos.trie.UnmodifiableIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ITERATOR

public static final Iterator EMPTY_ITERATOR
A constant EmptyIterator.

Constructor Detail

EmptyIterator

public EmptyIterator()
Method Detail

emptyIterator

public static <T> Iterator<T> emptyIterator()

hasNext

public boolean hasNext()

next

public Object next()


Copyright © 2008. All Rights Reserved.