JTemporal Home
Tutorial

net.sf.jtemporal.util
Class EmptyIterator

java.lang.Object
  extended by net.sf.jtemporal.util.EmptyIterator
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Iterator, CloseableIterator

public class EmptyIterator
extends java.lang.Object
implements java.io.Serializable, CloseableIterator, java.lang.Cloneable

Immutable empty read-only iterator (singleton).
For methods description, see java.util.Iterator

Version:
$Id: EmptyIterator.java,v 1.2 2005/06/05 21:49:30 tabeck Exp $
See Also:
Serialized Form

Method Summary
 java.lang.Object clone()
           
 void close()
          Closes the iterator.
static EmptyIterator getInstance()
          Given that the iterator is stateless, this is a singleton.
 boolean hasNext()
           As soon the method returns false the cursor is automatically closed.
 boolean isOpen()
          Checks whether the iterator is open, or already closed.
 java.lang.Object next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static EmptyIterator getInstance()
Given that the iterator is stateless, this is a singleton.

Returns:
the shared instance

hasNext

public boolean hasNext()
Description copied from interface: CloseableIterator
As soon the method returns false the cursor is automatically closed.
This implies that if you want to remove the last element you must call Iterator.remove() before calling this method again.

Specified by:
hasNext in interface java.util.Iterator
Specified by:
hasNext in interface CloseableIterator
See Also:
Iterator.hasNext()

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator

remove

public void remove()
Specified by:
remove in interface java.util.Iterator

close

public void close()
Description copied from interface: CloseableIterator
Closes the iterator.
Once this method has been called, the iterator behaves as it had reached the end of the list, and does not return more element.
This call releases all the linked resources (for example a database cursor).
It is recommended to call this method when you do not want to iterate until the last element.
If the cursor is already closed, this method just returns, with no error.

Specified by:
close in interface CloseableIterator

isOpen

public boolean isOpen()
Description copied from interface: CloseableIterator
Checks whether the iterator is open, or already closed.

Specified by:
isOpen in interface CloseableIterator
Returns:
true if the cursor is open.

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

JTemporal Home
Tutorial