Source of 14.15.java


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