/** * Unannounced quiz 1. * Array-based implementation of the List interface. * YOUR NAME: YOUR STUDENT ID: */ class ArrayList implements List { private static final int INITIAL_CAPACITY = 16; private Object[] _underlyingStorage; // The number of elements actually stored in _underlyingStorage private int _numElements; /** Creates an empty ArrayList with the default initial capacity. */ public ArrayList () { _underlyingStorage = new Object[INITIAL_CAPACITY]; _numElements = 0; } /** Adds object o to the end of the list. */ public add (Object o) { if (_numElements == _underlyingStorage.length) { // Create new aarry twice the previous size // Copy data from old to new array // Set _underlyingStorage to new array } _underlyingStorage[_numElements] = o; _numElements++; } /** Retrieves object stored at the specified index. */ public Object get (int index) { // Write your solution below: } /** Removes the object stored at the specified index. */ public void remove (int index) { // Write your solution below: } } } public void remove () { // You can use ArrayList.this.remove(index) here. } } }