/***************************************** * Karen Oertner * Lab 06 * Implementation of a link list * which has pointers to the * next node inserted, the next node * in ascending order, and the * next node in decending order. ******************************************/ public class TestDriver { public static void main(String[] args) { String s = ""; LinkList ll = new LinkList(); //add items to the list at the tail System.out.println("================================\nAdd items to tail "); ll.add("BBBBBB"); ll.add("AAAAA"); ll.add("TEST"); ll.add("Karen"); ll.add("Greg"); ll.add("aaaaa"); //print the lists System.out.println("\nThe linked list in inserted order: "); ll.printLLNext(); System.out.println("\n\nThe linked list in decending order (case sentitive): "); ll.printLLDecend(); System.out.println("\n\nThe linked list in ascending order (case sentitive): "); ll.printLLAscend(); //test the insert function - add items to the head of the list System.out.println("\n\n=============================\nInsert Function at beginning"); ll.insert("Susan"); ll.insert("Sara"); //print the lists System.out.println("\nThe linked list in inserted order:"); ll.printLLNext(); System.out.println("\n\nThe linked list in decending order (case sentitive): "); ll.printLLDecend(); System.out.println("\n\nThe linked list in ascending order (case sentitive): "); ll.printLLAscend(); //test the delete element function System.out.println("\n==============================\nDelete Element function (case sensitive): "); System.out.println(ll.delete("AAAAA")); System.out.println(ll.delete("Sara")); System.out.println(ll.delete("Gregs")); //print the lists System.out.println("\nThe linked list in inserted order: "); ll.printLLNext(); System.out.println("\n\nThe linked list in decending order (case sentitive): "); ll.printLLDecend(); System.out.println("\n\nThe linked list in ascending order (case sentitive): "); ll.printLLAscend(); //test the delete all elements function System.out.println("\n==============================\nDelete All Elements function: "); ll.deleteAll(); //print the lists System.out.println("\nThe linked list in inserted order: "); ll.printLLNext(); System.out.println("\n\nThe linked list in decending order (case sentitive): "); ll.printLLDecend(); System.out.println("\n\nThe linked list in ascending order (case sentitive): "); ll.printLLAscend(); //prove the delete function by adding new items to the list System.out.println("\n\n=============================\nRebuild list"); ll.insert("Sally"); ll.insert("David"); ll.add("Zero"); ll.add("Alpha"); //print the lists System.out.println("\nThe linked list in inserted order: "); ll.printLLNext(); System.out.println("\n\nThe linked list in decending order (case sentitive): "); ll.printLLDecend(); System.out.println("\n\nThe linked list in ascending order (case sentitive): "); ll.printLLAscend(); } }