The Department of Computer Science & Engineering
STUART C. SHAPIRO: CSE 116 B
boolean add(Object o).
Also, since ArrayLists and arrays are
sequential and indexed, how is a method such as
remove(int index) implemented?
See BasicList.java, and its documentation for an example implementation of several ArrayList methods.
Java has a predefined version of LinkedList
We will look at two implementations.
The first, LinkList (documentation), has a straight-forward recursive structure, but is a bit dificult because the empty list is not a LinkList.
The second, LinkdList (documentation), is completely recursive---even the empty LinkdList is a LinkdList---by using a null Object.
For an application of linked lists, see SortedList.java and AddressBook.java.