Top Description Inners Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.utility.iterable

public Class SnapshotCloneListIterable<E>

extends CloneListIterable<E>
Class Inheritance
Type Parameters
<E>
the type of elements returned by the list iterable's list iterator
Imports
java.util.Arrays, .List, .ListIterator, org.eclipse.persistence.jpa.jpql.utility.iterator.CloneListIterator

A 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.util.Vector); 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.Mutator 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.

See Also
CloneListIterator, LiveCloneListIterable, SnapshotCloneListIterable

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
SnapshotCloneListIterable.LocalCloneListIterator<E>

provide access to "internal" constructor

Field Summary

Modifier and TypeField and Description
private final Object[]
Inherited from org.eclipse.persistence.jpa.jpql.utility.iterable.CloneListIterable:
mutator

Constructor Summary

AccessConstructor and Description
public
SnapshotCloneListIterable(List<? extends E> list)

Construct a "snapshot" list iterable for the specified list.

public
SnapshotCloneListIterable(List<? extends E> list, CloneListIterator.Mutator<E> mutator)

Construct a "snapshot" list iterable for the specified list.

Method Summary

Modifier and TypeMethod and Description
public ListIterator<E>
iterator()

Implements org.eclipse.persistence.jpa.jpql.utility.iterable.ListIterable.iterator.

Returns an iterator over elements of type T.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.eclipse.persistence.jpa.jpql.utility.iterable.CloneListIterable:
addbuildDefaultMutatorremoveset

Field Detail

arrayback to summary
private final Object[] array

Constructor Detail

SnapshotCloneListIterableback to summary
public SnapshotCloneListIterable(List<? extends E> list)

Construct a "snapshot" list iterable for the specified list. The ListIterator modify operations will not be supported by the list iterator returned by iterator() unless a subclass overrides the list iterable's modify method.

SnapshotCloneListIterableback to summary
public SnapshotCloneListIterable(List<? extends E> list, CloneListIterator.Mutator<E> mutator)

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.

Method Detail

iteratorback to summary
public ListIterator<E> iterator()

Implements org.eclipse.persistence.jpa.jpql.utility.iterable.ListIterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:ListIterator<E>

an Iterator.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.eclipse.persistence.jpa.jpql.utility.iterable back to summary

protected Class SnapshotCloneListIterable.LocalCloneListIterator<E>

extends CloneListIterator<E>
Class Inheritance

provide access to "internal" constructor

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Inherited from org.eclipse.persistence.jpa.jpql.utility.iterator.CloneListIterator:
addaddhasNexthasPreviousnestedNextnestedPreviousnextnextIndexpreviouspreviousIndexremoveremovesetset

Constructor Detail

LocalCloneListIteratorback to summary
protected LocalCloneListIterator(CloneListIterator.Mutator<E> mutator, Object[] array)