Class SingleElementListIterable<E>
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.utility.iterable.SingleElementListIterable<E>
-
- Type Parameters:
E- the type of elements returned by the list iterable's list iterator
- All Implemented Interfaces:
java.lang.Iterable<E>,ListIterable<E>
public class SingleElementListIterable<E> extends java.lang.Object implements ListIterable<E>
ASingleElementListIterablereturns aListIteratorthat holds a single element and returns it with the first call toListIterator.next(), at which point it will returnfalseto any subsequent call toListIterator.hasNext(). Likewise, it will returnfalseto a call toListIterator.hasPrevious()until a call toListIterator.next(), at which point a call toListIterator.previous()will return the single element.A
SingleElementListIterableis equivalent to theIterablereturned by:Collections.singletonList(Object).
-
-
Constructor Summary
Constructors Constructor Description SingleElementListIterable(E element)Construct a list iterable that contains only the specified element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.ListIterator<E>iterator()java.lang.StringtoString()
-
-
-
Constructor Detail
-
SingleElementListIterable
public SingleElementListIterable(E element)
Construct a list iterable that contains only the specified element.
-
-
Method Detail
-
iterator
public java.util.ListIterator<E> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<E>- Specified by:
iteratorin interfaceListIterable<E>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-