Class SingleElementListIterator<E>
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.utility.iterator.SingleElementListIterator<E>
-
- All Implemented Interfaces:
java.util.Iterator<E>
,java.util.ListIterator<E>
public class SingleElementListIterator<E> extends java.lang.Object implements java.util.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.- Version:
- 2.4
- Since:
- 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()
java.util.ListIterator<E>
iterator()
E
next()
int
nextIndex()
E
previous()
int
previousIndex()
void
remove()
void
set(E item)
java.lang.String
toString()
-
-
-
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
-
hasNext
public boolean hasNext()
-
hasPrevious
public boolean hasPrevious()
- Specified by:
hasPrevious
in interfacejava.util.ListIterator<E>
-
iterator
public java.util.ListIterator<E> iterator()
-
next
public E next()
-
nextIndex
public int nextIndex()
- Specified by:
nextIndex
in interfacejava.util.ListIterator<E>
-
previousIndex
public int previousIndex()
- Specified by:
previousIndex
in interfacejava.util.ListIterator<E>
-
remove
public void remove()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
-