Class SingleElementListIterator<E>
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.utility.iterator.SingleElementListIterator<E>
-
- All Implemented Interfaces:
Iterator<E>
,ListIterator<E>
public class SingleElementListIterator<E> extends Object implements ListIterator<E>
ASingleElementListIterator
holds a single element and returns it with the first call tonext()
, at which point it will returnfalse
to any subsequent call tohasNext()
. Likewise, it will returnfalse
to a call tohasPrevious()
until a call tonext()
, at which point a call toprevious()
will return the single element.- Since:
- 2.4
- Version:
- 2.4
-
-
Constructor Summary
Constructors Constructor Description SingleElementListIterator(E element)
Creates a newSingleElementListIterator
that returns only the specified element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(E item)
boolean
hasNext()
boolean
hasPrevious()
ListIterator<E>
iterator()
E
next()
int
nextIndex()
E
previous()
int
previousIndex()
void
remove()
void
set(E item)
String
toString()
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
SingleElementListIterator
public SingleElementListIterator(E element)
Creates a newSingleElementListIterator
that returns only the specified element.- Parameters:
element
- The only element of thisIterator
-
-
Method Detail
-
add
public void add(E item)
- Specified by:
add
in interfaceListIterator<E>
-
hasNext
public boolean hasNext()
-
hasPrevious
public boolean hasPrevious()
- Specified by:
hasPrevious
in interfaceListIterator<E>
-
iterator
public ListIterator<E> iterator()
-
next
public E next()
-
nextIndex
public int nextIndex()
- Specified by:
nextIndex
in interfaceListIterator<E>
-
previous
public E previous()
- Specified by:
previous
in interfaceListIterator<E>
-
previousIndex
public int previousIndex()
- Specified by:
previousIndex
in interfaceListIterator<E>
-
remove
public void remove()
-
set
public void set(E item)
- Specified by:
set
in interfaceListIterator<E>
-
toString
public String toString()
- Overrides:
toString
in classObject
- See Also:
Object.toString()
-
-