SnapshotCloneListIterable returns a list iterator on a
"snapshot" of a list, allowing for concurrent access to the original list.
A copy of the list is created when the list iterable is constructed.
As a result, the contents of the list will be the same with
every call to iterator(), even if the original list is modified via
the list iterator's mutation methods.
The original list passed to the SnapshotCloneListIterable's
constructor should be thread-safe (e.g. java.);
otherwise you run the risk of a corrupted list.
By default, the list iterator returned by a SnapshotCloneListIterable does not
support the ListIterator mutation operations; this is because it does not
have access to the original list. But if the SnapshotCloneListIterable
is supplied with a CloneListIterator.
it will delegate the
ListIterator mutation operations to the Mutator.
Alternatively, a subclass can override the list iterable's mutation
methods.
This list iterable is useful for multiple passes over a list that should not be changed (e.g. by another thread) between passes.
CloneListIterator, LiveCloneListIterable, SnapshotCloneListIterable
| Modifier and Type | Class and Description |
|---|---|
| protected static class |
| Modifier and Type | Field and Description |
|---|---|
| private final Object[] |
| Access | Constructor and Description |
|---|---|
| public | SnapshotCloneListIterable(List<? extends E> list)
Construct a "snapshot" list iterable for the specified list. |
| public | SnapshotCloneListIterable(List<? extends E> list, CloneListIterator.
Construct a "snapshot" list iterable for the specified list. |
| Modifier and Type | Method and Description |
|---|---|
| public ListIterator | iterator()
Implements org. T.
|
| public String |
| array | back to summary |
|---|---|
| private final Object[] array | |
| SnapshotCloneListIterable | back to summary |
|---|---|
| public SnapshotCloneListIterable(List<? extends E> list) Construct a "snapshot" list iterable for the specified list.
The | |
| SnapshotCloneListIterable | back to summary |
|---|---|
| public SnapshotCloneListIterable(List<? extends E> list, CloneListIterator. Construct a "snapshot" list iterable for the specified list. The specified mutator will be used by any generated list iterators to modify the original list. | |
| iterator | back to summary |
|---|---|
| public ListIterator Implements org. 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 |
| LocalCloneListIterator | back to summary |
|---|---|
| protected LocalCloneListIterator(CloneListIterator. | |