E
- the type of elements returned by the iteratorpublic class CloneListIterator<E>
extends java.lang.Object
implements java.util.ListIterator<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 (e.g. Vector
.
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 CloneListIterator.Mutator
it will delegate the
modification operations to the CloneListIterator.Mutator
.
Alternatively, a subclass can override the modification methods.
Modifier and Type | Class and Description |
---|---|
static interface |
CloneListIterator.Mutator<T>
Used by
CloneListIterator to remove
elements from the original list; since the list iterator
does not have direct access to the original list. |
Constructor and 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(java.util.List<? extends E> list)
Construct a list iterator on a copy of the specified list.
|
CloneListIterator(java.util.List<? extends E> list,
CloneListIterator.Mutator<E> mutator)
Construct a list iterator on a copy of the specified list.
|
Modifier and Type | Method and Description |
---|---|
void |
add(E o) |
boolean |
hasNext() |
boolean |
hasPrevious() |
E |
next() |
int |
nextIndex() |
E |
previous() |
int |
previousIndex() |
void |
remove() |
void |
set(E o) |
public CloneListIterator(E[] array)
public CloneListIterator(E[] array, CloneListIterator.Mutator<E> mutator)
public CloneListIterator(java.util.List<? extends E> list)
public CloneListIterator(java.util.List<? extends E> list, CloneListIterator.Mutator<E> mutator)
public boolean hasNext()
public boolean hasPrevious()
hasPrevious
in interface java.util.ListIterator<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()
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference