Class ObjectListIterator<E>
- java.lang.Object
-
- com.globalmentor.collections.iterators.ObjectIterator<E>
-
- com.globalmentor.collections.iterators.ObjectListIterator<E>
-
- Type Parameters:
E
- The type of elements in this iterator
- All Implemented Interfaces:
java.lang.Iterable<E>
,java.util.Iterator<E>
,java.util.ListIterator<E>
public class ObjectListIterator<E> extends ObjectIterator<E> implements java.util.ListIterator<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.- Author:
- Garret Wilson
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
hasNext
Whether we've not retrieved the object.
-
Constructor Summary
Constructors Constructor Description ObjectListIterator(E object)
Object constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(E e)
This implementation does not support adding an element.boolean
hasNext()
boolean
hasPrevious()
E
next()
int
nextIndex()
E
previous()
int
previousIndex()
void
set(E e)
This implementation does not support setting the element.-
Methods inherited from class com.globalmentor.collections.iterators.ObjectIterator
iterator, remove
-
-
-
-
Constructor Detail
-
ObjectListIterator
public ObjectListIterator(E object)
Object constructor.- Parameters:
object
- The single object over which iteration should occur.
-
-
Method Detail
-
hasNext
public boolean hasNext()
Description copied from class:ObjectIterator
- Specified by:
hasNext
in interfacejava.util.Iterator<E>
- Specified by:
hasNext
in interfacejava.util.ListIterator<E>
- Overrides:
hasNext
in classObjectIterator<E>
- Returns:
true
if the single object has not yet been retrieved.
-
next
public E next()
- Specified by:
next
in interfacejava.util.Iterator<E>
- Specified by:
next
in interfacejava.util.ListIterator<E>
- Overrides:
next
in classObjectIterator<E>
-
hasPrevious
public boolean hasPrevious()
- Specified by:
hasPrevious
in interfacejava.util.ListIterator<E>
-
nextIndex
public int nextIndex()
- Specified by:
nextIndex
in interfacejava.util.ListIterator<E>
-
previousIndex
public int previousIndex()
- Specified by:
previousIndex
in interfacejava.util.ListIterator<E>
-
set
public void set(E e)
This implementation does not support setting the element.- Specified by:
set
in interfacejava.util.ListIterator<E>
-
-