1 *java.util.AbstractSequentialList* *AbstractSequentialList* This class provides
3 public abstract class AbstractSequentialList<E>
4 extends |java.util.AbstractList|
6 |java.util.AbstractSequentialList_Description|
7 |java.util.AbstractSequentialList_Fields|
8 |java.util.AbstractSequentialList_Constructors|
9 |java.util.AbstractSequentialList_Methods|
11 ================================================================================
13 *java.util.AbstractSequentialList_Constructors*
14 |java.util.AbstractSequentialList()|Sole constructor.
16 *java.util.AbstractSequentialList_Methods*
17 |java.util.AbstractSequentialList.add(int,E)|Inserts the specified element at t
18 |java.util.AbstractSequentialList.addAll(int,Collection<?extendsE>)|Inserts all
19 |java.util.AbstractSequentialList.get(int)|Returns the element at the specified
20 |java.util.AbstractSequentialList.iterator()|Returns an iterator over the eleme
21 |java.util.AbstractSequentialList.listIterator(int)|Returns a list iterator ove
22 |java.util.AbstractSequentialList.remove(int)|Removes the element at the specif
23 |java.util.AbstractSequentialList.set(int,E)|Replaces the element at the specif
25 *java.util.AbstractSequentialList_Description*
27 This class provides a skeletal implementation of the List interface to minimize
28 the effort required to implement this interface backed by a "sequential access"
29 data store (such as a linked list). For random access data (such as an array),
30 AbstractList should be used in preference to this class.
32 This class is the opposite of the AbstractList class in the sense that it
33 implements the "random access" methods (get(int index), set(int index, E
34 element), add(int index, E element) and remove(int index)) on top of the list's
35 list iterator, instead of the other way around.
37 To implement a list the programmer needs only to extend this class and provide
38 implementations for the listIterator and size methods. For an unmodifiable
39 list, the programmer need only implement the list iterator's hasNext, next,
40 hasPrevious, previous and index methods.
42 For a modifiable list the programmer should additionally implement the list
43 iterator's set method. For a variable-size list the programmer should
44 additionally implement the list iterator's remove and add methods.
46 The programmer should generally provide a void (no argument) and collection
47 constructor, as per the recommendation in the Collection interface
50 This class is a member of the <a
51 href="/../technotes/guides/collections/index.html"> Java Collections Framework.
55 *java.util.AbstractSequentialList()*
57 protected AbstractSequentialList()
59 Sole constructor. (For invocation by subclass constructors, typically
63 *java.util.AbstractSequentialList.add(int,E)*
69 Inserts the specified element at the specified position in this list (optional
70 operation). Shifts the element currently at that position (if any) and any
71 subsequent elements to the right (adds one to their indices).
73 This implementation first gets a list iterator pointing to the indexed element
74 (with listIterator(index)). Then, it inserts the specified element with
77 Note that this implementation will throw an UnsupportedOperationException if
78 the list iterator does not implement the add operation.
82 *java.util.AbstractSequentialList.addAll(int,Collection<?extendsE>)*
84 public boolean addAll(
86 java.util.Collection<? extends E> c)
88 Inserts all of the elements in the specified collection into this list at the
89 specified position (optional operation). Shifts the element currently at that
90 position (if any) and any subsequent elements to the right (increases their
91 indices). The new elements will appear in this list in the order that they are
92 returned by the specified collection's iterator. The behavior of this operation
93 is undefined if the specified collection is modified while the operation is in
94 progress. (Note that this will occur if the specified collection is this list,
97 This implementation gets an iterator over the specified collection and a list
98 iterator over this list pointing to the indexed element (with
99 listIterator(index)). Then, it iterates over the specified collection,
100 inserting the elements obtained from the iterator into this list, one at a
101 time, using ListIterator.add followed by ListIterator.next (to skip over the
104 Note that this implementation will throw an UnsupportedOperationException if
105 the list iterator returned by the listIterator method does not implement the
110 *java.util.AbstractSequentialList.get(int)*
112 public |E| get(int index)
114 Returns the element at the specified position in this list.
116 This implementation first gets a list iterator pointing to the indexed element
117 (with listIterator(index)). Then, it gets the element using ListIterator.next
122 *java.util.AbstractSequentialList.iterator()*
124 public |java.util.Iterator|<E> iterator()
126 Returns an iterator over the elements in this list (in proper sequence).
128 This implementation merely returns a list iterator over the list.
132 Returns: an iterator over the elements in this list (in proper sequence)
134 *java.util.AbstractSequentialList.listIterator(int)*
136 public abstract |java.util.ListIterator|<E> listIterator(int index)
138 Returns a list iterator over the elements in this list (in proper sequence).
141 index - index of first element to be returned from the list iterator (by a call to the
144 Returns: a list iterator over the elements in this list (in proper sequence)
146 *java.util.AbstractSequentialList.remove(int)*
148 public |E| remove(int index)
150 Removes the element at the specified position in this list (optional
151 operation). Shifts any subsequent elements to the left (subtracts one from
152 their indices). Returns the element that was removed from the list.
154 This implementation first gets a list iterator pointing to the indexed element
155 (with listIterator(index)). Then, it removes the element with
158 Note that this implementation will throw an UnsupportedOperationException if
159 the list iterator does not implement the remove operation.
163 *java.util.AbstractSequentialList.set(int,E)*
169 Replaces the element at the specified position in this list with the specified
170 element (optional operation).
172 This implementation first gets a list iterator pointing to the indexed element
173 (with listIterator(index)). Then, it gets the current element using
174 ListIterator.next and replaces it with ListIterator.set.
176 Note that this implementation will throw an UnsupportedOperationException if
177 the list iterator does not implement the set operation.