org.openbp.common.util.iterator
Class EmptyIterator

java.lang.Object
  extended by org.openbp.common.util.iterator.EmptyIterator
All Implemented Interfaces:
java.util.Iterator

public final class EmptyIterator
extends java.lang.Object
implements java.util.Iterator

Convenience class that can serve as an empty Iterator. In order to use the class, retrieve an instance using the getInstance() method.

Author:
Heiko Erhardt

Method Summary
static EmptyIterator getInstance()
          Returns a global instance of this object.
 boolean hasNext()
          Implementation of Iterator interface.
 java.lang.Object next()
          Implementation of the Iterator interface.
 void remove()
          Implementation of the Iterator interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static EmptyIterator getInstance()
Returns a global instance of this object. No problem, because this class does not contain any data.


hasNext

public boolean hasNext()
Implementation of Iterator interface.

Specified by:
hasNext in interface java.util.Iterator
Returns:
Always false

next

public java.lang.Object next()
Implementation of the Iterator interface.

Specified by:
next in interface java.util.Iterator
Returns:
Nothing, throws a NoSuchElementException instead

remove

public void remove()
Implementation of the Iterator interface. Always throws an IllegalStateException.

Specified by:
remove in interface java.util.Iterator


Copyright © 2011. All Rights Reserved.