// client code to test the RemoveAll method, comparing results against the // results for an ArrayList. import java.util.*; public class TestRemoveAll { public static void main(String[] args) { ArrayIntList list1 = new ArrayIntList(); ArrayIntList list2 = new ArrayIntList(); List list3 = new ArrayList(); List list4 = new ArrayList(); Random r = new Random(); for (int i = 0; i < 10; i++) { int n1 = r.nextInt(10); int n2 = r.nextInt(10); list1.add(n1); list3.add(n1); list2.add(n2); list4.add(n2); } System.out.println("original values:"); System.out.println(" list1 = " + list1); System.out.println(" list2 = " + list2); list1.removeAll(list2); list3.removeAll(list4); System.out.println("after the call list1.removeAll(list2):"); System.out.println(" list1 = " + list1); System.out.println(" list2 = " + list2); if (list1.toString().equals(list3.toString())) { System.out.println("passed"); } else { System.out.println("list1 should be = " + list3); } } }