//---------------------------------------------------------------------- // IndexedListInterface.java by Dale/Joyce/Weems Chapter 6 // // Extends the ListInterface with methods specific to indexed lists. // // All methods accepting an index Throw IndexOutOfBoundsException if // index < 0 or index > numElements. // // ajg version: Extends BOUNDEDListInterface // format //---------------------------------------------------------------------- package ch06.lists; public interface IndexedListInterface extends BoundedListInterface { void add(int index, T element); // Add element at position index; slide other elements down. T set(int index, T element); // Replace element at position index and return the replaced element. T get(int index); // Return the element at position index. int indexOf(T element); // If this list contains an element e such that e.equals(element), // Return index of first element e with e.equals(element) or -1 if no such e T remove(int index); // Remove and return element at position index; slide other elements up } // Local Variables: // compile-command: "cd ../..; javac ch06/lists/IndexedListInterface.java" // End: