E
- the type of elements returned by the iteratorpublic class CloneIterator<E>
extends java.lang.Object
implements java.util.Iterator<E>
CloneIterator
iterates over a copy of a collection,
allowing for concurrent access to the original collection.
The original collection passed to the CloneIterator
's
constructor should be synchronized (e.g. Vector
);
otherwise you run the risk of a corrupted collection.
By default, a CloneIterator
does not support the
remove()
operation; this is because it does not have
access to the original collection. But if the CloneIterator
is supplied with an CloneIterator.Remover
it will delegate the
remove()
operation to the CloneIterator.Remover
.
Alternatively, a subclass can override the remove(Object)
method.
Modifier and Type | Class and Description |
---|---|
static interface |
CloneIterator.Remover<T>
Used by
CloneIterator to remove
elements from the original collection; since the iterator
does not have direct access to the original collection. |
Constructor and Description |
---|
CloneIterator(java.util.Collection<? extends E> collection)
Construct an iterator on a copy of the specified collection.
|
CloneIterator(java.util.Collection<? extends E> collection,
CloneIterator.Remover<E> remover)
Construct an iterator on a copy of the specified collection.
|
CloneIterator(E[] array)
Construct an iterator on a copy of the specified array.
|
CloneIterator(E[] array,
CloneIterator.Remover<E> remover)
Construct an iterator on a copy of the specified array.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext() |
E |
next() |
void |
remove() |
public CloneIterator(java.util.Collection<? extends E> collection)
remove()
method will not be supported,
unless a subclass overrides the remove(Object)
.public CloneIterator(E[] array)
remove()
method will not be supported,
unless a subclass overrides the remove(Object)
.public CloneIterator(java.util.Collection<? extends E> collection, CloneIterator.Remover<E> remover)
public CloneIterator(E[] array, CloneIterator.Remover<E> remover)
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference