net.esper.collection
Class SingleObjectIterator<T>
java.lang.Object
net.esper.collection.SingleObjectIterator<T>
- All Implemented Interfaces:
- Iterator<T>
public class SingleObjectIterator<T>
- extends Object
- implements Iterator<T>
A utility class for an iterator that has zero or one element and can be reset with a new value.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SingleObjectIterator
public SingleObjectIterator(T object)
- Constructor, takes the single object to iterate over as a parameter.
The single object can be null indicating that there are no more elements.
- Parameters:
object
- single object that the iterator returns, or null for an empty iterator
SingleObjectIterator
public SingleObjectIterator()
- Ctor for an iterator starting out empty.
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface Iterator<T>
next
public T next()
- Specified by:
next
in interface Iterator<T>
remove
public void remove()
- Specified by:
remove
in interface Iterator<T>