### Question:
ArrayListOfDoubles implements RandomAccess, Cloneable, Iterable<Double> { public void sort() { trimToSize(); Arrays.sort(getArray()); } 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 testSort() { ArrayListOfDoubles a = new ArrayListOfDoubles(); assertEquals(0, a.size()); a.add(5.2f).add(6f).add(5.9f).add(4.1f); assertEquals(4, a.size()); a.sort(); assertEquals(4, a.size()); assertTrue(Math.abs(a.get(0) - 4.1) < 0.0001); assertTrue(Math.abs(a.get(1) - 5.2) < 0.0001); assertTrue(Math.abs(a.get(2) - 5.9) < 0.0001); assertTrue(Math.abs(a.get(3) - 6) < 0.0001); }