Class CloneListIterator<E>
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.utility.iterator.CloneListIterator<E>
-
- Type Parameters:
E- the type of elements returned by the iterator
- All Implemented Interfaces:
Iterator<E>,ListIterator<E>
public class CloneListIterator<E> extends Object implements ListIterator<E>
ACloneListIteratoriterates over a copy of a list, allowing for concurrent access to the original list.The original list passed to the
CloneListIterator's constructor should be synchronized; otherwise you run the risk of a corrupted list (e.g.Vector.By default, a
CloneListIteratordoes not support the modification operations; this is because it does not have access to the original list. But if theCloneListIteratoris supplied with aCloneListIterator.Mutatorit will delegate the modification operations to theCloneListIterator.Mutator. Alternatively, a subclass can override the modification methods.- See Also:
- LiveCloneListIterable, SnapshotCloneListIterable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceCloneListIterator.Mutator<T>Used byCloneListIteratorto remove elements from the original list; since the list iterator does not have direct access to the original list.
-
Constructor Summary
Constructors Constructor Description CloneListIterator(E[] array)Construct a list iterator on a copy of the specified array.CloneListIterator(E[] array, CloneListIterator.Mutator<E> mutator)Construct a list iterator on a copy of the specified array.CloneListIterator(List<? extends E> list)Construct a list iterator on a copy of the specified list.CloneListIterator(List<? extends E> list, CloneListIterator.Mutator<E> mutator)Construct a list iterator on a copy of the specified list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(E o)booleanhasNext()booleanhasPrevious()Enext()intnextIndex()Eprevious()intpreviousIndex()voidremove()voidset(E o)-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
CloneListIterator
public CloneListIterator(E[] array)
Construct a list iterator on a copy of the specified array. The modification methods will not be supported, unless a subclass overrides them.
-
CloneListIterator
public CloneListIterator(E[] array, CloneListIterator.Mutator<E> mutator)
Construct a list iterator on a copy of the specified array. Use the specified list mutator to modify the original list.
-
CloneListIterator
public CloneListIterator(List<? extends E> list)
Construct a list iterator on a copy of the specified list. The modification methods will not be supported, unless a subclass overrides them.
-
CloneListIterator
public CloneListIterator(List<? extends E> list, CloneListIterator.Mutator<E> mutator)
Construct a list iterator on a copy of the specified list. Use the specified list mutator to modify the original list.
-
-
Method Detail
-
add
public void add(E o)
- Specified by:
addin interfaceListIterator<E>
-
hasNext
public boolean hasNext()
-
hasPrevious
public boolean hasPrevious()
- Specified by:
hasPreviousin interfaceListIterator<E>
-
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 o)
- Specified by:
setin interfaceListIterator<E>
-
-