de.unidu.is.util
Class SingleItemIterator

java.lang.Object
  extended byde.unidu.is.util.SingleItemIterator
All Implemented Interfaces:
java.util.Iterator

public class SingleItemIterator
extends java.lang.Object
implements java.util.Iterator

A iterator that returns only one single item.

Since:
2001-04-29
Version:
$Revision: 1.6 $, $Date: 2005/02/28 22:27:55 $
Author:
Henrik Nottelmann

Field Summary
protected  boolean called
          Indicates if next() has ever been called.
protected  java.lang.Object item
          The only object returned by this iterator.
 
Constructor Summary
SingleItemIterator(java.lang.Object item)
          Creates a new iterator.
 
Method Summary
 boolean hasNext()
          Returns true if this iterator has more elements.
 java.lang.Object next()
          Returns the next object.
 void remove()
          Removing objects is unsupported!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

item

protected java.lang.Object item
The only object returned by this iterator.


called

protected boolean called
Indicates if next() has ever been called.

Constructor Detail

SingleItemIterator

public SingleItemIterator(java.lang.Object item)
Creates a new iterator.

Parameters:
item - only object returned by this iterator
Method Detail

hasNext

public boolean hasNext()
Returns true if this iterator has more elements.

Specified by:
hasNext in interface java.util.Iterator
Returns:
true if the iterator has more elements

next

public java.lang.Object next()
Returns the next object.

Specified by:
next in interface java.util.Iterator
Returns:
next object
Throws:
java.util.NoSuchElementException - if there is no object available

remove

public void remove()
Removing objects is unsupported!

Specified by:
remove in interface java.util.Iterator