|
EclipseLink 2.5.0, build 'v20130507-3faac2b' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.persistence.jpa.jpql.utility.iterator.CloneListIterator<E>
E
- the type of elements returned by the iteratorpublic class CloneListIterator<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.
org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable
,
org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneListIterable
Nested Class Summary | |
---|---|
static interface |
CloneListIterator.Mutator<T>
Used by CloneListIterator to remove
elements from the original list; since the list iterator
does not have direct access to the original list. |
Constructor Summary | |
---|---|
protected |
CloneListIterator(CloneListIterator.Mutator<E> mutator,
java.lang.Object... array)
Internal constructor used by subclasses. |
|
CloneListIterator(E[] array)
Construct a list iterator on a copy of the specified array. |
|
CloneListIterator(E[] array,
CloneListIterator.Mutator<E> mutator)
Construct a list iterator on a copy of the specified array. |
|
CloneListIterator(java.util.List<? extends E> list)
Construct a list iterator on a copy of the specified list. |
|
CloneListIterator(java.util.List<? extends E> list,
CloneListIterator.Mutator<E> mutator)
Construct a list iterator on a copy of the specified list. |
Method Summary | |
---|---|
void |
add(E o)
|
protected void |
add(int index,
E o)
Add the specified element to the original list. |
boolean |
hasNext()
|
boolean |
hasPrevious()
|
protected E |
nestedNext()
The list passed in during construction held elements of type E ,
so this cast is not a problem. |
protected E |
nestedPrevious()
The list passed in during construction held elements of type E ,
so this cast is not a problem. |
E |
next()
|
int |
nextIndex()
|
E |
previous()
|
int |
previousIndex()
|
void |
remove()
|
protected void |
remove(int index)
Remove the specified element from the original list. |
void |
set(E o)
|
protected void |
set(int index,
E o)
Set the specified element in the original list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CloneListIterator(E[] array)
public CloneListIterator(E[] array, CloneListIterator.Mutator<E> mutator)
public CloneListIterator(java.util.List<? extends E> list)
public CloneListIterator(java.util.List<? extends E> list, CloneListIterator.Mutator<E> mutator)
protected CloneListIterator(CloneListIterator.Mutator<E> mutator, java.lang.Object... array)
Method Detail |
---|
public void add(E o)
add
in interface java.util.ListIterator<E>
protected void add(int index, E o)
This method can be overridden by a subclass as an
alternative to building a CloneListIterator.Mutator
.
public boolean hasNext()
hasNext
in interface java.util.Iterator<E>
hasNext
in interface java.util.ListIterator<E>
public boolean hasPrevious()
hasPrevious
in interface java.util.ListIterator<E>
protected E nestedNext()
E
,
so this cast is not a problem. We need this cast because
all the elements of the original collection were copied into
an object array (Object[]
).
protected E nestedPrevious()
E
,
so this cast is not a problem. We need this cast because
all the elements of the original collection were copied into
an object array (Object[]
).
public E next()
next
in interface java.util.Iterator<E>
next
in interface java.util.ListIterator<E>
public int nextIndex()
nextIndex
in interface java.util.ListIterator<E>
public E previous()
previous
in interface java.util.ListIterator<E>
public int previousIndex()
previousIndex
in interface java.util.ListIterator<E>
public void remove()
remove
in interface java.util.Iterator<E>
remove
in interface java.util.ListIterator<E>
protected void remove(int index)
This method can be overridden by a subclass as an
alternative to building a CloneListIterator.Mutator
.
public void set(E o)
set
in interface java.util.ListIterator<E>
protected void set(int index, E o)
This method can be overridden by a subclass as an
alternative to building a CloneListIterator.Mutator
.
|
EclipseLink 2.5.0, build 'v20130507-3faac2b' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |