Merge git+ssh://davetron5000@repo.or.cz/srv/git/vimdoclet
[vimdoclet.git] / sample / java.util.ListIterator.txt
blob79095632f7ade33b67ac408ac574272671c08ac1
1 *java.util.ListIterator* *ListIterator* An iterator for lists that allows the pr
3 public interface interface ListIterator
5   implements |java.util.Iterator|
7 |java.util.ListIterator_Description|
8 |java.util.ListIterator_Fields|
9 |java.util.ListIterator_Constructors|
10 |java.util.ListIterator_Methods|
12 ================================================================================
14 *java.util.ListIterator_Methods*
15 |java.util.ListIterator.add(E)|Inserts the specified element into the list (opt
16 |java.util.ListIterator.hasNext()|Returns true if this list iterator has more e
17 |java.util.ListIterator.hasPrevious()|Returns true if this list iterator has mo
18 |java.util.ListIterator.next()|Returns the next element in the list.
19 |java.util.ListIterator.nextIndex()|Returns the index of the element that would
20 |java.util.ListIterator.previous()|Returns the previous element in the list.
21 |java.util.ListIterator.previousIndex()|Returns the index of the element that w
22 |java.util.ListIterator.remove()|Removes from the list the last element that wa
23 |java.util.ListIterator.set(E)|Replaces the last element returned by next or  p
25 *java.util.ListIterator_Description*
27 An iterator for lists that allows the programmer to traverse the list in either 
28 direction, modify the list during iteration, and obtain the iterator's current 
29 position in the list. A ListIterator has no current element; its cursor 
30 position always lies between the element that would be returned by a call to 
31 previous() and the element that would be returned by a call to next(). In a 
32 list of length n, there are n+1 valid index values, from 0 to n, inclusive. 
34 Element(0) Element(1) Element(2) ... Element(n) ^ ^ ^ ^ ^ Index: 0 1 2 3 n+1 
38 Note that the (|java.util.ListIterator|) and (|java.util.ListIterator|) methods 
39 are not defined in terms of the cursor position; they are defined to operate on 
40 the last element returned by a call to (|java.util.ListIterator|) or 
41 (|java.util.ListIterator|) . 
43 This interface is a member of the <a href="/../guide/collections/index.html"> 
44 Java Collections Framework. 
47 *java.util.ListIterator.add(E)*
49 public void add(java.lang.Object o)
51 Inserts the specified element into the list (optional operation). The element 
52 is inserted immediately before the next element that would be returned by next, 
53 if any, and after the next element that would be returned by previous, if any. 
54 (If the list contains no elements, the new element becomes the sole element on 
55 the list.) The new element is inserted before the implicit cursor: a subsequent 
56 call to next would be unaffected, and a subsequent call to previous would 
57 return the new element. (This call increases by one the value that would be 
58 returned by a call to nextIndex or previousIndex.) 
60     o - the element to insert. 
62 *java.util.ListIterator.hasNext()*
64 public boolean hasNext()
66 Returns true if this list iterator has more elements when traversing the list 
67 in the forward direction. (In other words, returns true if next would return an 
68 element rather than throwing an exception.) 
71     Returns: true if the list iterator has more elements when traversing the list in the 
72              forward direction. 
73 *java.util.ListIterator.hasPrevious()*
75 public boolean hasPrevious()
77 Returns true if this list iterator has more elements when traversing the list 
78 in the reverse direction. (In other words, returns true if previous would 
79 return an element rather than throwing an exception.) 
82     Returns: true if the list iterator has more elements when traversing the list in the 
83              reverse direction. 
84 *java.util.ListIterator.next()*
86 public |java.lang.Object| next()
88 Returns the next element in the list. This method may be called repeatedly to 
89 iterate through the list, or intermixed with calls to previous to go back and 
90 forth. (Note that alternating calls to next and previous will return the same 
91 element repeatedly.) 
94     Returns: the next element in the list. 
95 *java.util.ListIterator.nextIndex()*
97 public int nextIndex()
99 Returns the index of the element that would be returned by a subsequent call to 
100 next. (Returns list size if the list iterator is at the end of the list.) 
103     Returns: the index of the element that would be returned by a subsequent call to next, 
104              or list size if list iterator is at end of list. 
105 *java.util.ListIterator.previous()*
107 public |java.lang.Object| previous()
109 Returns the previous element in the list. This method may be called repeatedly 
110 to iterate through the list backwards, or intermixed with calls to next to go 
111 back and forth. (Note that alternating calls to next and previous will return 
112 the same element repeatedly.) 
115     Returns: the previous element in the list. 
116 *java.util.ListIterator.previousIndex()*
118 public int previousIndex()
120 Returns the index of the element that would be returned by a subsequent call to 
121 previous. (Returns -1 if the list iterator is at the beginning of the list.) 
124     Returns: the index of the element that would be returned by a subsequent call to 
125              previous, or -1 if list iterator is at beginning of list. 
126 *java.util.ListIterator.remove()*
128 public void remove()
130 Removes from the list the last element that was returned by next or previous 
131 (optional operation). This call can only be made once per call to next or 
132 previous. It can be made only if ListIterator.add has not been called after the 
133 last call to next or previous. 
136 *java.util.ListIterator.set(E)*
138 public void set(java.lang.Object o)
140 Replaces the last element returned by next or previous with the specified 
141 element (optional operation). This call can be made only if neither 
142 ListIterator.remove nor ListIterator.add have been called after the last call 
143 to next or previous. 
145     o - the element with which to replace the last element returned by next or 
146        previous.