AbstractSequentialList is also an abstract class, which is as follows: Public Abstract Class AbstractSequentialList Extends AbstractList For AbstractList: http://blog.9cbs.net/treeroot/archive/2004/09/14/104743.aspx
This class is relatively simple.
public Object get (int index) {ListIterator e = listIterator (index); try {return (e.next ());} catch (NoSuchElementException exc) {throw (new IndexOutOfBoundsException ( "Index:" index));}}
public Object set (int index, Object element) {ListIterator e = listIterator (index); try {Object oldVal = e.next (); e.set (element); return oldVal;} catch (NoSuchElementException exc) {throw (new IndexOutofboundsexception ("INDEX:" index);}}
Public void add (int index, object element) {listiterator e = listiterator (index); E.Add (element);
public Object remove (int index) {ListIterator e = listIterator (index); Object outCast; try {outCast = e.next ();} catch (NoSuchElementException exc) {throw (new IndexOutOfBoundsException ( "Index:" index)); } E.Remove (); Return (Outcast);
Public Boolean Addall (INDEX, Collection C) {Boolean Modified = False; Listiterator E1 = ListIterator (Index); Iterator E2 = C.ITerator (); while (e2.hasnext ()) {e1.add (e2.next ))); Modified = true;} returnemified;}
Public iterator itrator () {return listiterator ();
Public Abstract Listiterator Listiterator (INT INDEX);
Note that all methods use iterators, obviously designed, not fast-fail, should be a simpler whether it is not a sub-class to rewrite these methods. Since these codes are relatively simple, there are similar situations in some of the previous classes. Here is a universal implementation, which is just to facilitate analyzing LinkedList because LinkedList is its subclass.