public interface IntegerList { /** Accessors/Getters **/ /* Returns integer at the index * Throws IndexOutOfBoundsException if index is not w/i bounds [0...size) */ public int get( int index ); /* Returns the number of elements in the list */ public int size(); /* Returns the full size of the containing array */ public int capacity(); /* Returns true if there are 0 elements in the list */ public boolean isEmpty(); /* Returns a copy of all the elements in the array; size = size() */ public int[] toArray(); /* Returns a String representation of the elements in the array; * (non-Javadoc) * @see java.lang.Object#toString() */ public String toString(); /** Modifiers/Setters **/ /* Insert integer into array at index * If index is within existing array, [0-size), performs left shift then insert * If index is == size, inserts only * if index is > size throws */ public void insert( int index, int integer); /* Appends integer onto the list * Returns the index integer was inserted to */ public int add( int integer ); /* Appends list of integers onto the list * Returns the last index inserted into */ public int add( int[] listOfInteger ); /* Removes element at index from the array * Returns the element removed * Throws IndexOutOfBoundsException if index is not w/i bounds [0...size) */ public int remove( int index ); /* Sets value of element at index * Returns the previous value of the element at index * Throws IndexOutOfBoundsException if index is not w/i bounds [0...size) */ public int set( int index, int integer); }