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. java.);
otherwise you run the risk of a corrupted collection.
By default, the iterator returned by a SnapshotCloneIterable does not
support the Iterator#remove() operation; this is because it does not
have access to the original collection. But if the SnapshotCloneIterable
is supplied with a CloneIterator.
it will delegate the
Iterator#remove() operation to the Remover.
Alternatively, a subclass can override the iterable's 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.
CloneIterator, LiveCloneIterable, SnapshotCloneListIterable
| Modifier and Type | Class and Description |
|---|---|
| protected static class |
| Modifier and Type | Field and Description |
|---|---|
| private final Object[] |
| Access | Constructor and Description |
|---|---|
| public | SnapshotCloneIterable(Iterator<? extends E> iterator)
Construct a "snapshot" iterable for the specified iterator. |
| public | SnapshotCloneIterable(Iterator<? extends E> iterator, CloneIterator.
Construct a "snapshot" iterable for the specified iterator. |
| public | SnapshotCloneIterable(Collection<? extends E> collection)
Construct a "snapshot" iterable for the specified collection. |
| public | SnapshotCloneIterable(Collection<? extends E> collection, CloneIterator.
Construct a "snapshot" iterable for the specified collection. |
| array | back to summary |
|---|---|
| private final Object[] array | |
| SnapshotCloneIterable | back to summary |
|---|---|
| public SnapshotCloneIterable(Iterator<? extends E> iterator) Construct a "snapshot" iterable for the specified iterator.
The | |
| SnapshotCloneIterable | back to summary |
|---|---|
| public SnapshotCloneIterable(Iterator<? extends E> iterator, CloneIterator. Construct a "snapshot" iterable for the specified iterator. The specified remover will be used by any generated iterators to remove objects from the original collection. | |
| SnapshotCloneIterable | back to summary |
|---|---|
| public SnapshotCloneIterable(Collection<? extends E> collection) Construct a "snapshot" iterable for the specified collection.
The | |
| SnapshotCloneIterable | back to summary |
|---|---|
| public SnapshotCloneIterable(Collection<? extends E> collection, CloneIterator. Construct a "snapshot" iterable for the specified collection. The specified remover will be used by any generated iterators to remove objects from the original collection. | |
| iterator | back to summary |
|---|---|
| public Iterator Implements java. Doc from java. Returns an iterator over elements of type | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Access | Constructor and Description |
|---|---|
| protected |
| LocalCloneIterator | back to summary |
|---|---|
| protected LocalCloneIterator(CloneIterator. | |