|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.jpa.jpql.util.iterator.CloneIterator<E>
public class CloneIterator<E>
A 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; 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 Mutator
it will delegate the remove()
operation to the
Mutator
. Alternatively, a subclass can override the remove(Object)
method.
Constructor Summary | |
---|---|
CloneIterator(java.util.Collection<? extends E> collection)
Creates a new CloneIterator using a copy of the specified collection. |
|
CloneIterator(java.util.Collection<? extends E> collection,
Mutator<? extends E> mutator)
Creates a new CloneIterator using a copy of the specified collection. |
Method Summary | |
---|---|
boolean |
hasNext()
|
java.util.Iterator<E> |
iterator()
|
E |
next()
|
void |
remove()
|
protected void |
remove(E item)
Removes the specified element from the original collection. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CloneIterator(java.util.Collection<? extends E> collection)
CloneIterator
using a copy of the specified collection. The remove()
method will not be supported, unless a subclass overrides remove(Object)
.
collection
- The collection that is copied in order to iterate over its items without
being changed concurrentlypublic CloneIterator(java.util.Collection<? extends E> collection, Mutator<? extends E> mutator)
CloneIterator
using a copy of the specified collection. Use the
specified mutator to remove objects from the original collection.
collection
- The collection that is copied in order to iterate over its items without
being changed concurrentlymutator
- This Mutator
is used to remove the item from the original collectionMethod Detail |
---|
public boolean hasNext()
hasNext
in interface java.util.Iterator<E>
public java.util.Iterator<E> iterator()
iterator
in interface java.lang.Iterable<E>
public E next()
next
in interface java.util.Iterator<E>
public void remove()
remove
in interface java.util.Iterator<E>
protected void remove(E item)
This method can be overridden by a subclass as an alternative to building a Mutator
.
item
- The element to remove from the original collectionpublic java.lang.String toString()
toString
in class java.lang.Object
|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |