IntList { public static IntList reverse(IntList A) { if (A.equals(null)) { return A; } IntList prev, ptr, next; prev = A; ptr = prev.rest; prev.rest = null; while (ptr.rest != null) { next = ptr.rest; ptr.rest = prev; prev = ptr; ptr = next; } ptr.rest = prev; return ptr; } IntList(int first0, IntList rest0);  IntList(); static void dSquareList(IntList L); static IntList squareListIterative(IntList L); static IntList squareListRecursive(IntList L); static IntList dcatenate(IntList A, IntList B); static IntList catenate(IntList A, IntList B); static IntList reverse(IntList A); @Override int hashCode(); static IntList of(Integer... args); boolean equals(Object x); @Override /** Outputs the IntList as a String. You are not expected to read * or understand this method. */ String toString();  }
@Test(timeout = 1000) public void testReverse() { IntList A = IntList.of(1, 2, 3); IntList expA = IntList.of(3, 2, 1); assertEquals(expA, IntList.reverse(A)); }