public class LinkedListTest1
1:
2: package test;
3:
4: import mylist.*;
5:
6: public class LinkedListTest1 {
7:
8: public static void main(String args[])
9: throws CloneNotSupportedException {
10: LinkedList l = new LinkedList();
11: l.insertHead(new Integer(1));
12: l.insertHead(new Integer(2));
13: l.insertLast(new Integer(3));
14: l.insertLast(new Integer(4));
15: l.insert(new Integer(5), 3);
16: l.insert(new Integer(6), 3);
17: l.insert(new Integer(7), 3);
18:
19: System.out.println("First pass");
20: System.out.println(l);
21:
22: l.removeHead();
23: l.removeLast();
24: l.remove(2);
25:
26: System.out.println("Second pass");
27: System.out.println(l);
28:
29: LinkedList l2 = (LinkedList) l.clone();
30: System.out.println("Cloned list");
31: System.out.println(l2);
32:
33: l2.removeHead();
34: System.out.println("Original list");
35: System.out.println(l);
36: System.out.println("Cloned list");
37: System.out.println(l2);
38:
39: }
40:
41: }