|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
CoinsIterator.java Created on August 11, 2002, 5:48 PM
Iterator that can accomodate the structural modification in any way in the underlying list, without throwing ConcurrentModificationException.
When an object is added to the underlying list, what is returned by the subsequent call to next
(next element of this iterator) will be the same as when there were no such addition. What is returned by the call to previous
will be the same as before, except for the case where the new object was added just before the next element, in which case the newly added object will be returned. The result of the call to nextIndex
and previousIndex
will be incremented by one if the element was added somewhere before the next element.
When an object is removed from the underlying list, what is returned by the subsequent call to next
and previous
will be altered if what was removed was what would be returned if there was no such removal. In that case, next
and previous
return the next element and the previous element of what was removed (before its removal), respectively (if any). nextIndex
and previousIndex
will be decremented by one if the next element of this iterator before the call to remove
lied somewhere after what was removed.
ListIterator
メソッドの概要 | |
void |
add(java.lang.Object o)
Returns what was returned by the previous call to next or previous
This is what will be removed by remove . |
void |
addAfter(java.lang.Object o)
Adds an element to the underlying list after the imaginary cursor of this iterator. |
java.lang.Object |
next()
Returns the next element, and advances the imaginary cursor by one. |
int |
nextIndex()
Returns the index of the next element |
java.lang.Object |
previous()
Returns the previous element, and steps back the imaginary cursor by one. |
int |
previousIndex()
Returns the index of the previous element |
void |
remove()
Remove what was returned by the previous call to next or previous |
インタフェース java.util.ListIterator から継承したメソッド |
hasNext, hasPrevious, set |
メソッドの詳細 |
public java.lang.Object next()
java.util.ListIterator
内の next
public java.lang.Object previous()
java.util.ListIterator
内の previous
public int nextIndex()
java.util.ListIterator
内の nextIndex
public int previousIndex()
java.util.ListIterator
内の previousIndex
public void remove()
next
or previous
java.util.ListIterator
内の remove
java.lang.IllegalStateException
- if either there was no call to either next
or previous
, what was returned by such a call is already removed from the underlying list, or this iterator's method that structurally modifies the underlying list was called after such a call to next
or previous
.public void add(java.lang.Object o)
next
or previous
This is what will be removed by remove
. In the situation where remove
will throw IllegalArgumentException
, this method will return null
.
Object lastReturned();
/**
Adds an element to the underlying list before the imaginary cursor of this iterator. That is, the subsequent call to next
will be unaffected while the call to previous
will return the object added by this method.
java.util.ListIterator
内の add
public void addAfter(java.lang.Object o)
previous
will be unaffected while the call to next
will return the object added by this method.
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |