Class OneElementIterator<T>
- java.lang.Object
-
- com.saperion.common.lang.iterator.OneElementIterator<T>
-
- Type Parameters:
T
- type of objects to iterate
- All Implemented Interfaces:
java.util.Iterator<T>
public final class OneElementIterator<T> extends java.lang.Object implements java.util.Iterator<T>
An
Iterator
that iterates through exactly one element.Iterator.remove()
is not supported.- Author:
- agz
-
-
Constructor Summary
Constructors Constructor Description OneElementIterator(T object)
Creates a newOneElementIterator
, that iterates through exactly one (the specified) element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
T
next()
void
remove()
java.lang.String
toString()
-
-
-
Constructor Detail
-
OneElementIterator
public OneElementIterator(T object)
Creates a newOneElementIterator
, that iterates through exactly one (the specified) element. The specified object may benull
. The newOneElementIterator
will still have one element and its first call to next() will returnnull
.- Parameters:
object
- object to iterate through
-
-