1: // Listing 12-2 2: // @author Frank M. Carrano, Timothy M. Henry 3: // @version 5.0 4: public static void main(String[] args) 5: { 6: System.out.println("Create an empty list."); 7: ListInterface<String> myList = new LList<String>(); 8: System.out.println("List should be empty; isEmpty returns " + 9: myList.isEmpty() + "."); 11: System.out.println("\nTesting add to end:"); 12: myList.add("15"); 13: myList.add("25"); 14: myList.add("35"); 15: myList.add("45"); 16: System.out.println("List should contain 15 25 35 45."); 17: displayList(myList); 18: System.out.println("List should not be empty; isEmpty() returns " + 19: myList.isEmpty() + "."); 20: System.out.println("\nTesting clear():"); 21: myList.clear(); 22: System.out.println("List should be empty; isEmpty returns " + 23: myList.isEmpty() + "."); 24: } // end main 25: /* 26: Create an empty list. 27: List should be empty; isEmpty returns true. 28: 29: Testing add to end: 30: List should contain 15 25 35 45. 31: The list contains 4 entries, as follows: 32: 15 25 35 45 33: List should not be empty; isEmpty() returns false. 34: 35: Testing clear(): 36: List should be empty; isEmpty returns true. 37: */