// This class provides a skeletal implementation of the List interface // to minimize effort required to implement it. public abstract class AbstractList implements IntList { /* 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 all List methods will not compile. * * Can't do this now that it's abstract * AbstractList list = new AbstractList(); */ // Adds the given value to the end of the list. public boolean add(int value) { return add(size(), value); } //public abstract int destroy(); // Returns true if the value is in the list, false otherwise. public boolean contains(int value) { return indexOf(value) != -1; } // Returns true if list is empty, false otherwise. public final boolean isEmpty() { return size() == 0; } }