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. java..
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.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | CloneListIterator.Mutator<T>
Used by |
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private final ListIterator | |
| private final CloneListIterator. | |
| private CloneListIterator. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | CloneListIterator(E[] array, CloneListIterator.
Construct a list iterator on a copy of the specified array. |
| public | |
| public | CloneListIterator(List<? extends E> list, CloneListIterator.
Construct a list iterator on a copy of the specified list. |
| protected | CloneListIterator(CloneListIterator.
Internal constructor used by subclasses. |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(E
the element to insert o)Implements java. |
| protected void | |
| public boolean | hasNext()
Implements java. true if this list iterator has more elements when
traversing the list in the forward direction.
|
| public boolean | hasPrevious()
Implements java. true if this list iterator has more elements when
traversing the list in the reverse direction.
|
| protected E | nestedNext()
The list passed in during construction held elements of type |
| protected E | nestedPrevious()
The list passed in during construction held elements of type |
| public E | next()
Implements java. |
| public int | nextIndex()
Implements java. next.
|
| public E | previous()
Implements java. |
| public int | previousIndex()
Implements java. previous.
|
| public void | remove()
Implements java. next or previous (optional operation).
|
| protected void | |
| public void | set(E
the element with which to replace the last element returned by
o)next or previousImplements java. next or
previous with the specified element (optional operation).
|
| protected void |
| cursor | back to summary |
|---|---|
| private int cursor | |
| listIterator | back to summary |
|---|---|
| private final ListIterator<Object> listIterator | |
| mutator | back to summary |
|---|---|
| private final CloneListIterator. | |
| state | back to summary |
|---|---|
| private CloneListIterator. | |
| CloneListIterator | back to summary |
|---|---|
| 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 | back to summary |
|---|---|
| public CloneListIterator(E[] array, CloneListIterator. Construct a list iterator on a copy of the specified array. Use the specified list mutator to modify the original list. | |
| CloneListIterator | back to summary |
|---|---|
| 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 | back to summary |
|---|---|
| public CloneListIterator(List<? extends E> list, CloneListIterator. Construct a list iterator on a copy of the specified list. Use the specified list mutator to modify the original list. | |
| CloneListIterator | back to summary |
|---|---|
| protected CloneListIterator(CloneListIterator. Internal constructor used by subclasses. Swap order of arguments to prevent collision with other constructor. The passed in array will *not* be cloned. | |
| add | back to summary |
|---|---|
| public void add(E o) Implements java. Doc from java. Inserts the specified element into the list (optional operation).
The element is inserted immediately before the element that
would be returned by
| |
| add | back to summary |
|---|---|
| protected void add(int index, E o) Add the specified element to the original list.
This method can be overridden by a subclass as an
alternative to building a | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| hasPrevious | back to summary |
|---|---|
| public boolean hasPrevious() Implements java. Doc from java. Returns
| |
| nestedNext | back to summary |
|---|---|
| protected E nestedNext() The list passed in during construction held elements of type
| |
| nestedPrevious | back to summary |
|---|---|
| protected E nestedPrevious() The list passed in during construction held elements of type
| |
| next | back to summary |
|---|---|
| public E next() Implements java. Doc from java. Returns the next element in the list and advances the cursor position.
This method may be called repeatedly to iterate through the list,
or intermixed with calls to
| |
| nextIndex | back to summary |
|---|---|
| public int nextIndex() Implements java. Doc from java. Returns the index of the element that would be returned by a
subsequent call to
| |
| previous | back to summary |
|---|---|
| public E previous() Implements java. Doc from java. Returns the previous element in the list and moves the cursor
position backwards. This method may be called repeatedly to
iterate through the list backwards, or intermixed with calls to
| |
| previousIndex | back to summary |
|---|---|
| public int previousIndex() Implements java. Doc from java. Returns the index of the element that would be returned by a
subsequent call to
| |
| remove | back to summary |
|---|---|
| public void remove() Implements java. Doc from java. Removes from the list the last element that was returned by
| |
| remove | back to summary |
|---|---|
| protected void remove(int index) Remove the specified element from the original list.
This method can be overridden by a subclass as an
alternative to building a | |
| set | back to summary |
|---|---|
| public void set(E o) Implements java. Doc from java. Replaces the last element returned by
| |
| set | back to summary |
|---|---|
| protected void set(int index, E o) Set the specified element in the original list.
This method can be overridden by a subclass as an
alternative to building a | |
CloneListIterator to remove
elements from the original list; since the list iterator
does not have direct access to the original list.
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void |
| add | back to summary |
|---|---|
| public void add(int index, T o) Add the specified object to the original list. | |
| remove | back to summary |
|---|---|
| public void remove(int index) Remove the specified object from the original list. | |
| set | back to summary |
|---|---|
| public void set(int index, T o) Set the specified object in the original list. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final CloneListIterator. | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(int index, Object o)
Implements org. |
| public static <R> CloneListIterator. | |
| private Object | |
| public void | remove(int index)
Implements org. |
| public void | set(int index, Object o)
Implements org. |
| INSTANCE | back to summary |
|---|---|
public static final CloneListIterator.
| |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| ReadOnly | back to summary |
|---|---|
| private ReadOnly() | |
| add | back to summary |
|---|---|
| public void add(int index, Object o) Implements org. Doc from org. Add the specified object to the original list.
| |
| instance | back to summary |
|---|---|
public static <R> CloneListIterator.
| |
| readResolve | back to summary |
|---|---|
| private Object readResolve() | |
| remove | back to summary |
|---|---|
| public void remove(int index) Implements org. Doc from org. Remove the specified object from the original list.
| |
| set | back to summary |
|---|---|
| public void set(int index, Object o) Implements org. Doc from org. Set the specified object in the original list.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final CloneListIterator. | |
| public static final CloneListIterator. | |
| public static final CloneListIterator. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static CloneListIterator. | |
| public static CloneListIterator. |
| NEXT | back to summary |
|---|---|
| public static final CloneListIterator. | |
| PREVIOUS | back to summary |
|---|---|
| public static final CloneListIterator. | |
| UNKNOWN | back to summary |
|---|---|
| public static final CloneListIterator. | |
| State | back to summary |
|---|---|
| private State() | |
| valueOf | back to summary |
|---|---|
| public static CloneListIterator. | |
| values | back to summary |
|---|---|
| public static CloneListIterator. | |