|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.common.collect.ForwardingObject com.google.common.collect.ForwardingIterator<E> com.google.common.collect.ForwardingListIterator<E>
public abstract class ForwardingListIterator<E>
A list iterator which forwards all its method calls to another list iterator. Subclasses should override one or more methods to modify the behavior of the backing iterator as desired per the decorator pattern.
Constructor Summary | |
---|---|
protected |
ForwardingListIterator()
Constructor for use by subclasses. |
Method Summary | |
---|---|
void |
add(E element)
Inserts the specified element into the list (optional operation). |
protected abstract ListIterator<E> |
delegate()
Returns the backing delegate instance that methods are forwarded to. |
boolean |
hasPrevious()
Returns true if this list iterator has more elements when
traversing the list in the reverse direction. |
int |
nextIndex()
Returns the index of the element that would be returned by a subsequent call to ListIterator.next() . |
E |
previous()
Returns the previous element in the list and moves the cursor position backwards. |
int |
previousIndex()
Returns the index of the element that would be returned by a subsequent call to ListIterator.previous() . |
void |
set(E element)
Replaces the last element returned by ListIterator.next() or
ListIterator.previous() with the specified element (optional operation). |
Methods inherited from class com.google.common.collect.ForwardingIterator |
---|
hasNext, next, remove |
Methods inherited from class com.google.common.collect.ForwardingObject |
---|
toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.ListIterator |
---|
hasNext, next, remove |
Constructor Detail |
---|
protected ForwardingListIterator()
Method Detail |
---|
protected abstract ListIterator<E> delegate()
ForwardingObject
ForwardingSet.delegate()
. Concrete subclasses override this method to supply
the instance being decorated.
delegate
in class ForwardingIterator<E>
public void add(E element)
java.util.ListIterator
ListIterator.next()
, if any, and after the next
element that would be returned by ListIterator.previous()
, if any. (If the
list contains no elements, the new element becomes the sole element
on the list.) The new element is inserted before the implicit
cursor: a subsequent call to next
would be unaffected, and a
subsequent call to previous
would return the new element.
(This call increases by one the value that would be returned by a
call to nextIndex
or previousIndex
.)
add
in interface ListIterator<E>
element
- the element to insertpublic boolean hasPrevious()
java.util.ListIterator
true
if this list iterator has more elements when
traversing the list in the reverse direction. (In other words,
returns true
if ListIterator.previous()
would return an element
rather than throwing an exception.)
hasPrevious
in interface ListIterator<E>
true
if the list iterator has more elements when
traversing the list in the reverse directionpublic int nextIndex()
java.util.ListIterator
ListIterator.next()
. (Returns list size if the list
iterator is at the end of the list.)
nextIndex
in interface ListIterator<E>
next
, or list size if the list
iterator is at the end of the listpublic E previous()
java.util.ListIterator
ListIterator.next()
to go back and forth. (Note that alternating calls
to next
and previous
will return the same
element repeatedly.)
previous
in interface ListIterator<E>
public int previousIndex()
java.util.ListIterator
ListIterator.previous()
. (Returns -1 if the list
iterator is at the beginning of the list.)
previousIndex
in interface ListIterator<E>
previous
, or -1 if the list
iterator is at the beginning of the listpublic void set(E element)
java.util.ListIterator
ListIterator.next()
or
ListIterator.previous()
with the specified element (optional operation).
This call can be made only if neither ListIterator.remove()
nor ListIterator.add(E)
have been called after the last call to next
or
previous
.
set
in interface ListIterator<E>
element
- the element with which to replace the last element returned by
next
or previous
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |