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>
ASingleElementListIterable
returns aListIterator
that holds a single element and returns it with the first call toListIterator.next()
, at which point it will returnfalse
to any subsequent call toListIterator.hasNext()
. Likewise, it will returnfalse
to a call toListIterator.hasPrevious()
until a call toListIterator.next()
, at which point a call toListIterator.previous()
will return the single element.A
SingleElementListIterable
is equivalent to theIterable
returned 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.String
toString()
-
-
-
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:
iterator
in interfacejava.lang.Iterable<E>
- Specified by:
iterator
in interfaceListIterable<E>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-