public class CloneListIterator<E> extends java.lang.Object implements IterableListIterator<E>
CloneListIterator
iterates 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.
By default, a CloneListIterator
does not support the modification operations; this
is because it does not have access to the original list. But if the CloneListIterator
is supplied with a Mutator
it will delegate the modification operations to the Mutator
. Alternatively, a subclass can override the modification methods.
Constructor and Description |
---|
CloneListIterator(java.util.List<? extends E> list)
Creates a new
CloneListIterator using a copy of the specified list. |
CloneListIterator(java.util.List<? extends E> list,
ListMutator<E> mutator)
Construct a list iterator on a copy of the specified list.
|
public CloneListIterator(java.util.List<? extends E> list)
CloneListIterator
using a copy of the specified list. The
modification methods will not be supported, unless a subclass overrides them.list
- The list that is copied in order to iterate over its items without being changed concurrentlypublic CloneListIterator(java.util.List<? extends E> list, ListMutator<E> mutator)
ListMutator
to modify the original list.list
- The list that is copied in order to iterate over its items without being changed concurrentlymutator
- This ListMutator
is used to remove the item from the original listpublic boolean hasNext()
public boolean hasPrevious()
hasPrevious
in interface java.util.ListIterator<E>
public java.util.ListIterator<E> iterator()
iterator
in interface java.lang.Iterable<E>
iterator
in interface IterableListIterator<E>
public E next()
public int nextIndex()
nextIndex
in interface java.util.ListIterator<E>
public int previousIndex()
previousIndex
in interface java.util.ListIterator<E>
public void remove()
public java.lang.String toString()
toString
in class java.lang.Object
EclipseLink 2.4.2, "build v20130514-5956486" API Reference