Please send questions to st10@humboldt.edu .
/* TestDiffLists.java 1.0                            */
/* by Sharon Tuttle                                  */
/* last modified: 3-7-03                             */
/*                                                   */
/* answering the question: can I *really* use        */
/* either of these implementations for a method      */
/* expecting a list of type Cs132List?               */

public class TestDiffLists extends JPFalt 
{
    public static void main(String[] args) 
    { 
            new TestDiffLists(); 
    }
    
    /*-----------------------------------------------------------
     playing()
     Purpose: takes any list of type Cs132List, and uses the
              standard list methods from that interface to 
              give that list a new 1st element of "Hello", a
              new last element of "Goodbye", and a new 2nd
              element of "Bonjour"
    --------------------------------------------------------------*/
    void playing(Cs132List aList)
    {
        println("\nCalled playing with list: " + aList);
        
        aList.addFirst("Hello");
        expected("Hello is now first element in list");
        actual(aList);
        
        aList.addLast("Goodbye");
        expected("Goodbye is now last element in list");
        actual(aList);
        
        try
        {
            aList.add(1, "Bonjour");
        }
        catch(Exception ex) {}
        expected("Bonjour is now 2nd element in list");
        actual(aList);
    }
    
    /*-----------------------------------------------------------
     playingTest()
     Purpose: see if I really CAN call playing with either my
              array-list or linked-list
    -------------------------------------------------------------*/
    void playingTest()
    {
        Cs132ArrayList myAList = new Cs132ArrayList();
        Cs132LinkedList myLList = new Cs132LinkedList();
        
        playing(myAList);
        println("\nafter playing call, myAList is:" + myAList);
        
        myLList.addFirst("George");
        myLList.addLast("Harold");
        playing(myLList);
        println("\nafter playing call, myLList is:" + myLList);
    }
}