|
EclipseLink 2.5.0, build 'v20130507-3faac2b' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.persistence.jpa.jpql.tools.utility.iterable.CloneIterable<E>
org.eclipse.persistence.jpa.jpql.tools.utility.iterable.SnapshotCloneIterable<E>
E
- the type of elements returned by the iterable's iteratorpublic class SnapshotCloneIterable<E>
A SnapshotCloneIterable
returns an iterator on a "snapshot" of a
collection, allowing for concurrent access to the original collection. A
copy of the collection is created when the iterable is constructed.
As a result, the contents of the collection will be the same with
every call to iterator()
.
The original collection passed to the SnapshotCloneIterable
's
constructor should be thread-safe (e.g. Vector
);
otherwise you run the risk of a corrupted collection.
By default, the iterator returned by a SnapshotCloneIterable
does not
support the CloneIterator.remove()
operation; this is because it does not
have access to the original collection. But if the SnapshotCloneIterable
is supplied with a org.eclipse.jpt.common.utility.internal.iterators.CloneIterator.Remover
it will delegate the
CloneIterator.remove()
operation to the Remover
.
Alternatively, a subclass can override the iterable's CloneIterable.remove(Object)
method.
This iterable is useful for multiple passes over a collection that should not be changed (e.g. by another thread) between passes.
SnapshotCloneIterable.LocalCloneIterator
,
LiveCloneIterable
,
SnapshotCloneListIterable
Nested Class Summary | |
---|---|
protected static class |
SnapshotCloneIterable.LocalCloneIterator<E>
provide access to "internal" constructor |
Nested classes/interfaces inherited from class org.eclipse.persistence.jpa.jpql.tools.utility.iterable.CloneIterable |
---|
CloneIterable.DefaultRemover |
Constructor Summary | |
---|---|
SnapshotCloneIterable(java.util.Collection<? extends E> collection)
Construct a "snapshot" iterable for the specified collection. |
|
SnapshotCloneIterable(java.util.Collection<? extends E> collection,
CloneIterator.Remover<E> remover)
Construct a "snapshot" iterable for the specified collection. |
|
SnapshotCloneIterable(java.util.Iterator<? extends E> iterator)
Construct a "snapshot" iterable for the specified iterator. |
|
SnapshotCloneIterable(java.util.Iterator<? extends E> iterator,
CloneIterator.Remover<E> remover)
Construct a "snapshot" iterable for the specified iterator. |
Method Summary | |
---|---|
java.util.Iterator<E> |
iterator()
|
java.lang.String |
toString()
|
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.utility.iterable.CloneIterable |
---|
buildDefaultRemover, remove |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SnapshotCloneIterable(java.util.Iterator<? extends E> iterator)
CloneIterator.remove()
operation will not be supported
by the iterator returned by iterator()
unless a subclass overrides the iterable's CloneIterable.remove(Object)
method.
public SnapshotCloneIterable(java.util.Iterator<? extends E> iterator, CloneIterator.Remover<E> remover)
public SnapshotCloneIterable(java.util.Collection<? extends E> collection)
CloneIterator.remove()
operation will not be supported
by the iterator returned by iterator()
unless a subclass overrides the iterable's CloneIterable.remove(Object)
method.
public SnapshotCloneIterable(java.util.Collection<? extends E> collection, CloneIterator.Remover<E> remover)
Method Detail |
---|
public java.util.Iterator<E> iterator()
public java.lang.String toString()
toString
in class java.lang.Object
|
EclipseLink 2.5.0, build 'v20130507-3faac2b' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |