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>
ASingleElementListIteratorholds a single element and returns it with the first call tonext(), at which point it will returnfalseto any subsequent call tohasNext(). Likewise, it will returnfalseto 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 newSingleElementListIteratorthat returns only the specified element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(E item)booleanhasNext()booleanhasPrevious()ListIterator<E>iterator()Enext()intnextIndex()Eprevious()intpreviousIndex()voidremove()voidset(E item)StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
SingleElementListIterator
public SingleElementListIterator(E element)
Creates a newSingleElementListIteratorthat returns only the specified element.- Parameters:
element- The only element of thisIterator
-
-
Method Detail
-
add
public void add(E item)
- Specified by:
addin interfaceListIterator<E>
-
hasNext
public boolean hasNext()
-
hasPrevious
public boolean hasPrevious()
- Specified by:
hasPreviousin interfaceListIterator<E>
-
iterator
public ListIterator<E> iterator()
-
next
public E next()
-
nextIndex
public int nextIndex()
- Specified by:
nextIndexin interfaceListIterator<E>
-
previous
public E previous()
- Specified by:
previousin interfaceListIterator<E>
-
previousIndex
public int previousIndex()
- Specified by:
previousIndexin interfaceListIterator<E>
-
remove
public void remove()
-
set
public void set(E item)
- Specified by:
setin interfaceListIterator<E>
-
toString
public String toString()
- Overrides:
toStringin classObject- See Also:
Object.toString()
-
-