// Helene Martin, CSE 143 // This class provides a skeletal implementation of the List interface // to minimize the effort required to implement it. // Abstract classes are a good way to provide a partially implemented class. // This class compiles despite not implementing all of the List interface's methods // because abstract classes can't be directly instantiated and must instead be extended. // A subclass of AbstractList that doesn't implement the rest of the List interface will // not compile. public abstract class AbstractList implements List { // Adds the given value to the end of the list. public void add(E value) { add(size(), value); } // Returns true if the value is in the list, false otherwise. public boolean contains(E value) { return indexOf(value) != -1; } // Returns true if list is empty, false otherwise. public boolean isEmpty() { return size() == 0; } }