### Question:
ArrayListOfDoubles implements RandomAccess, Cloneable, Iterable<Double> { public double remove(int index) { if (index >= size) { throw new ArrayIndexOutOfBoundsException(); } double oldValue = array[index]; int numMoved = size - index - 1; if (numMoved > 0) { System.arraycopy(array, index + 1, array, index, numMoved); } size--; return oldValue; } ArrayListOfDoubles(int initialCapacity);  ArrayListOfDoubles();  ArrayListOfDoubles(double[] a);  ArrayListOfDoubles(int first, int last); void trimToSize(); void ensureCapacity(int minCapacity); int size(); void setSize(int sz); boolean isEmpty(); boolean contains(double n); int indexOf(double n); int lastIndexOf(double n); ArrayListOfDoubles clone(); double get(int index); double set(int index, double element); ArrayListOfDoubles add(double e); ArrayListOfDoubles add(int index, double element); double remove(int index); void clear(); double[] getArray(); Iterator<Double> iterator(); String toString(int n); @Override String toString(); void sort(); ArrayListOfDoubles intersection(ArrayListOfDoubles other); ArrayListOfDoubles merge(ArrayListOfDoubles sortedLst); ArrayListOfDoubles subList(int start, int end); void addUnique(int[] arr); void shiftLastNToTop(int n); @Override boolean equals(Object obj);  }### Answer:
@Test public void testArrayConstructor() { double[] arr = new double[] { 1.0, 2.0, 3.0, 4.0, 5.0 }; assertEquals(5, arr.length); ArrayListOfDoubles list = new ArrayListOfDoubles(arr); list.remove(2); assertEquals(1.0, arr[0], 10e-6); assertEquals(2.0, arr[1], 10e-6); assertEquals(3.0, arr[2], 10e-6); assertEquals(4.0, arr[3], 10e-6); assertEquals(5.0, arr[4], 10e-6); }
@Test public void testRemove() { ArrayListOfDoubles list = new ArrayListOfDoubles(); for (int i = 0; i < 10; i++) { list.add((double) i); } list.remove(list.indexOf(5.0)); assertEquals(9, list.size()); assertEquals(0.0, list.get(0), 10e-6); assertEquals(1.0, list.get(1), 10e-6); assertEquals(2.0, list.get(2), 10e-6); assertEquals(3.0, list.get(3), 10e-6); assertEquals(4.0, list.get(4), 10e-6); assertEquals(6.0, list.get(5), 10e-6); assertEquals(7.0, list.get(6), 10e-6); assertEquals(8.0, list.get(7), 10e-6); assertEquals(9.0, list.get(8), 10e-6); list.remove(list.indexOf((short) 9)); assertEquals(8, list.size); assertEquals(0.0, list.get(0), 10e-6); assertEquals(1.0, list.get(1), 10e-6); assertEquals(2.0, list.get(2), 10e-6); assertEquals(3.0, list.get(3), 10e-6); assertEquals(4.0, list.get(4), 10e-6); assertEquals(6.0, list.get(5), 10e-6); assertEquals(7.0, list.get(6), 10e-6); assertEquals(8.0, list.get(7), 10e-6); }