Class ObjectIterator<E>
- java.lang.Object
-
- com.globalmentor.collections.iterators.ObjectIterator<E>
-
- Type Parameters:
E
- The type of elements in this iterator
- All Implemented Interfaces:
java.lang.Iterable<E>
,java.util.Iterator<E>
- Direct Known Subclasses:
ObjectListIterator
public class ObjectIterator<E> extends java.lang.Object implements java.util.Iterator<E>, java.lang.Iterable<E>
An iterable and iterator to a single object. This implementation allowsnull
values. This implementation does not allow removal, as removing has no meaning in this context. This version releases the object when iteration has occurred (i.e. whenhasNext()
would returnfalse
).- Author:
- Garret Wilson
-
-
Constructor Summary
Constructors Constructor Description ObjectIterator(E object)
Object constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
java.util.Iterator<E>
iterator()
This implementation returnsthis
.E
next()
void
remove()
This implementation does not support removal.
-
-
-
Field Detail
-
object
protected E object
The single object being iterated.
-
hasNext
protected boolean hasNext
Whether we've not retrieved the object.
-
-
Constructor Detail
-
ObjectIterator
public ObjectIterator(E object)
Object constructor.- Parameters:
object
- The single object over which iteration should occur.
-
-