@Test public void testCatenate() { IntList A = IntList.of(1, 2, 3); IntList B = IntList.of(4, 5, 6); IntList exp = IntList.of(1, 2, 3, 4, 5, 6); assertEquals(exp, IntList.catenate(A, B)); assertEquals(IntList.of(1, 2, 3), A); }
public static IntList catenate(IntList A, IntList B) { IntList res = new IntList(A.first, null); IntList ptr = res; A = A.rest; while (A != null) { ptr.rest = new IntList(A.first, null); ptr = ptr.rest; A = A.rest; } ptr.rest = B; return res; }
IntList { public static IntList catenate(IntList A, IntList B) { IntList res = new IntList(A.first, null); IntList ptr = res; A = A.rest; while (A != null) { ptr.rest = new IntList(A.first, null); ptr = ptr.rest; A = A.rest; } ptr.rest = B; return res; } }
IntList { public static IntList catenate(IntList A, IntList B) { IntList res = new IntList(A.first, null); IntList ptr = res; A = A.rest; while (A != null) { ptr.rest = new IntList(A.first, null); ptr = ptr.rest; A = A.rest; } ptr.rest = B; return res; } IntList(int first0, IntList rest0);  IntList(); }
IntList { public static IntList catenate(IntList A, IntList B) { IntList res = new IntList(A.first, null); IntList ptr = res; A = A.rest; while (A != null) { ptr.rest = new IntList(A.first, null); ptr = ptr.rest; A = A.rest; } ptr.rest = B; return res; } 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); @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(); }
IntList { public static IntList catenate(IntList A, IntList B) { IntList res = new IntList(A.first, null); IntList ptr = res; A = A.rest; while (A != null) { ptr.rest = new IntList(A.first, null); ptr = ptr.rest; A = A.rest; } ptr.rest = B; return res; } 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); @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(); public int first; public IntList rest; }