### Question:
ArrayListOfDoubles implements RandomAccess, Cloneable, Iterable<Double> { public ArrayListOfDoubles add(double e) { ensureCapacity(size + 1); array[size++] = e; return this; } 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 testIterable() { int size = 1000; Random r = new Random(); double[] doubles = new double[size]; ArrayListOfDoubles list = new ArrayListOfDoubles(); for (int i = 0; i < size; i++) { double k = r.nextDouble(); list.add(k); doubles[i] = k; } int i = 0; for (Double v : list) { assertEquals(doubles[i++], v, 10e-5); } }