public class SingletonIterator
extends java.lang.Object
implements java.util.Iterator
SingletonIterator
is an Iterator
over a single
object instance.
Constructor and Description |
---|
SingletonIterator(java.lang.Object object)
Constructs a new
SingletonIterator . |
public SingletonIterator(java.lang.Object object)
SingletonIterator
.object
- the single object to return from the iteratorpublic boolean hasNext()
This returns true if the single object hasn't been returned yet.
hasNext
in interface java.util.Iterator
public java.lang.Object next()
This returns the single object if it hasn't been returned yet.
next
in interface java.util.Iterator
java.util.NoSuchElementException
- if the single object has already
been returnedpublic void remove()
UnsupportedOperationException
.remove
in interface java.util.Iterator
java.lang.UnsupportedOperationException
- alwaysCopyright © 2001-2004 Apache Software Foundation. Documenation generated May 18 2012.