|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.jpa.jpql.util.iterator.CloneListIterator<E>
public 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.
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 Mutator
it will delegate the modification operations to the Mutator
. Alternatively, a subclass can override the modification methods.
Constructor Summary | |
---|---|
CloneListIterator(java.util.List<? extends E> list)
Creates a new CloneListIterator using a copy of the specified list. |
|
CloneListIterator(java.util.List<? extends E> list,
ListMutator<E> mutator)
Construct a list iterator on a copy of the specified list. |
Method Summary | |
---|---|
void |
add(E item)
|
protected void |
add(int index,
E item)
Adds the specified element to the original list. |
boolean |
hasNext()
|
boolean |
hasPrevious()
|
java.util.ListIterator<E> |
iterator()
|
E |
next()
|
int |
nextIndex()
|
E |
previous()
|
int |
previousIndex()
|
void |
remove()
|
protected void |
remove(int index)
Removes the specified element from the original list. |
void |
set(E item)
|
protected void |
set(int index,
E item)
Sets the specified element in the original list. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CloneListIterator(java.util.List<? extends E> list)
CloneListIterator
using a copy of the specified list. The
modification methods will not be supported, unless a subclass overrides them.
list
- The list that is copied in order to iterate over its items without being changed concurrentlypublic CloneListIterator(java.util.List<? extends E> list, ListMutator<E> mutator)
ListMutator
to modify the original list.
list
- The list that is copied in order to iterate over its items without being changed concurrentlymutator
- This ListMutator
is used to remove the item from the original listMethod Detail |
---|
public void add(E item)
add
in interface java.util.ListIterator<E>
protected void add(int index, E item)
This method can be overridden by a subclass as an alternative to building a Mutator
.
index
- The index of insertionitem
- The element to insert into the listpublic 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>
public java.util.ListIterator<E> iterator()
iterator
in interface java.lang.Iterable<E>
iterator
in interface IterableListIterator<E>
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 ListMutator
.
index
- The position of the item to remove from the original listpublic void set(E item)
set
in interface java.util.ListIterator<E>
protected void set(int index, E item)
This method can be overridden by a subclass as an alternative to building a ListMutator
.
index
- The index of replacementitem
- The element to replace the existing onepublic java.lang.String toString()
toString
in class java.lang.Object
|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |