This week, we’ll ask you to implement array-based lists, following the lecture notes; use AL.java as a base.

Methods to implement, lightly adapted from java.util.List

boolean add(E) // at end
void add(int, E) // at index

E get(int)
int indexOf(E) // from left
int lastIndexOf(E) // from right

E set(int, E) // set index, return old value

E remove(int) // remove index, return removed element
boolean remove(E) // remove (leftmost) object, return true if found

boolean isEmpty()
int size()

void clear() // remove all elements from the list

// harder
boolean contains(E)
boolean equals(Object)
int hashCode()
E[] toArray() // use the pattern in the constructor to allocate a generic array