|
Bill Teter email: william.teter@plattsburgh.edu |
|
|
Lab 9 ArrayList and LinkedList implementations Start with the interface MyList<E> and implementations for ArrayList<E> and LinkedList<E> classes that are in the public directory for lab9. add the following methods as they are specified for the List interface in the Java API to the MyList<E> interface, and to each of the implementations--ArrayList and LinkedList. In the documentation for each method give the complexity in worst case of your method implementation as a function of list size. Test each method as you develop the code. int indexOf(Object x) void clear() int size() void add(int index, E elm) E remove(int index) boolean remove(Object o) E get(int index) boolean equals(Object o) Notice that ArrayList implements Iterable. We will discuss in class on Friday what this means, and why the code works. You will make LinkedList implement Iterable as well. |