jade.util.leap
Class EmptyIterator

java.lang.Object
  |
  +--jade.util.leap.EmptyIterator
All Implemented Interfaces:
java.util.Iterator, Iterator

public class EmptyIterator
extends java.lang.Object
implements Iterator

Singleton Iterator for an empty collection. The usage of the singleton-pattern for this simple object allows just to save some memory.

Version:
$Date: 2003-11-20 17:04:51 +0100 (gio, 20 nov 2003) $ $Revision: 4573 $
Author:
Fabio Bellifemine, TILAB

Method Summary
static Iterator getInstance()
          Returns the singleton EmptyIterator object.
 boolean hasNext()
          Checks whether the iterator can scan further.
 java.lang.Object next()
          Retrieves the next element in the collection scanned by this iterator.
 void remove()
          Remove the element pointed to by this iterator from the collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Iterator getInstance()
Returns the singleton EmptyIterator object. Most of the methods of this class are instance methods and must be invoked with respect to the singleton object.


hasNext

public boolean hasNext()
Checks whether the iterator can scan further.

Specified by:
hasNext in interface java.util.Iterator
Returns:
This method always returns false.

next

public java.lang.Object next()
Retrieves the next element in the collection scanned by this iterator.

Specified by:
next in interface java.util.Iterator
Returns:
This method always throws an exception.
Throws:
java.util.NoSuchElementException - Always, because the underlying collection is always empty.

remove

public void remove()
Remove the element pointed to by this iterator from the collection.

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.RuntimeException - Always, because the underlying collection is always empty.


JADE