Class CloneListIterator<E>

  • Type Parameters:
    E - the type of elements returned by the iterator
    All Implemented Interfaces:
    Iterator<E>, ListIterator<E>

    public class CloneListIterator<E>
    extends Object
    implements ListIterator<E>
    A CloneListIterator iterates over a copy of a list, allowing for concurrent access to the original list.

    The original list passed to the CloneListIterator's constructor should be synchronized; otherwise you run the risk of a corrupted list (e.g. Vector.

    By default, a CloneListIterator does not support the modification operations; this is because it does not have access to the original list. But if the CloneListIterator is supplied with a CloneListIterator.Mutator it will delegate the modification operations to the CloneListIterator.Mutator. Alternatively, a subclass can override the modification methods.

    See Also:
    LiveCloneListIterable, SnapshotCloneListIterable
    • Constructor Detail

      • CloneListIterator

        public CloneListIterator​(E[] array)
        Construct a list iterator on a copy of the specified array. The modification methods will not be supported, unless a subclass overrides them.
      • CloneListIterator

        public CloneListIterator​(E[] array,
                                 CloneListIterator.Mutator<E> mutator)
        Construct a list iterator on a copy of the specified array. Use the specified list mutator to modify the original list.
      • CloneListIterator

        public CloneListIterator​(List<? extends E> list)
        Construct a list iterator on a copy of the specified list. The modification methods will not be supported, unless a subclass overrides them.
      • CloneListIterator

        public CloneListIterator​(List<? extends E> list,
                                 CloneListIterator.Mutator<E> mutator)
        Construct a list iterator on a copy of the specified list. Use the specified list mutator to modify the original list.