### Question:
ArrayListOfDoubles implements RandomAccess, Cloneable, Iterable<Double> { public ArrayListOfDoubles subList(int start, int end) { ArrayListOfDoubles sublst = new ArrayListOfDoubles(end - start + 1); for (int i = start; i <= end; i++) { sublst.add(get(i)); } return sublst; } 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 testSubList() { ArrayListOfDoubles a = new ArrayListOfDoubles(new double[] { 1, 2, 3, 4, 5, 6, 7 }); ArrayListOfDoubles c = a.subList(1, 5); assertEquals(5, c.size()); assertTrue(Math.abs(2 - c.get(0)) < 0.0001); assertTrue(Math.abs(3 - c.get(1)) < 0.0001); assertTrue(Math.abs(4 - c.get(2)) < 0.0001); assertTrue(Math.abs(5 - c.get(3)) < 0.0001); assertTrue(Math.abs(6 - c.get(4)) < 0.0001); a.clear(); assertEquals(5, c.size()); assertTrue(Math.abs(2 - c.get(0)) < 0.0001); assertTrue(Math.abs(3 - c.get(1)) < 0.0001); assertTrue(Math.abs(4 - c.get(2)) < 0.0001); assertTrue(Math.abs(5 - c.get(3)) < 0.0001); assertTrue(Math.abs(6 - c.get(4)) < 0.0001); }