
/*
 * LinkedList2 test program
 *
 * burton rosenberg
 * 20 Sept 2001
 *
 * inserts words in words array to tail or head 
 * of an initially empty list, according to whether insAt 
 * is true ( insert at tail ) or false ( insert at head ).
 *
 */

class LinkedList2Test
{

   static String [] words = { "apple", "banana", "cherry", "dumble-berry" } ;
   static boolean[] insAt = { true, false, true, false } ; 

   public static void main( String [] args )
   {
       LinkedList2 ll = new LinkedList2() ;
       for ( int i=0; i<words.length; i++ )
       {
           if ( insAt[i] )
           {
              // insert at tail
              System.out.println("insertAtTail "+words[i]) ;
              ll.insertAtTail( words[i] ) ;
           }
           else
           {
              // insert at head
              System.out.println("insertAtHead "+words[i]) ;
              ll.insertAtHead( words[i] ) ;
           }
           System.out.println("printList:") ;
           ll.printList() ;
           System.out.println() ;
       }
   }
}

