org.eclipse.persistence.jpa.jpql.utility.iterator.CloneListIterator Maven / Gradle / Ivy
Show all versions of eclipselink Show documentation
/*******************************************************************************
* Copyright (c) 2006, 2014 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Oracle - initial API and implementation
*
******************************************************************************/
package org.eclipse.persistence.jpa.jpql.utility.iterator;
import java.io.Serializable;
import java.util.List;
import java.util.ListIterator;
import org.eclipse.persistence.jpa.jpql.utility.CollectionTools;
/**
* 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. {@link java.util.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 {@link Mutator} it will delegate the
* modification operations to the {@link Mutator}.
* Alternatively, a subclass can override the modification methods.
*
* @param the type of elements returned by the iterator
*
* @see LiveCloneListIterable
* @see SnapshotCloneListIterable
*/
public class CloneListIterator
implements ListIterator
{
private int cursor;
private final ListIterator