// TestLinkedList.java
// TestLinnkedList class to demonstrate List capabilities.
package chapter35;

public class TestLinkedList
{
    public static void main( String args[] )
    {
        List list = new List(); // create the List container

        // insert integers in list
        // JVM autoboxes each literal value in an Integer object
        // Insert objects at the beginning of the list using method insertAtFront
        list.insertAtFront( 7 );
        list.print();
        list.insertAtFront( 11 );
        list.print();
        list.insertAtFront( 12 );
        list.print();
        // Insert objects at the end of the list using method insertAtBack
        list.insertAtBack( 5 );
        list.print();

        // Deletes objects from the front of the list using method removeFromFront
        Object removedObject = list.removeFromFront();
        System.out.printf( "%s removed\n", removedObject );
        // Call List method print to display the current list contents
        list.print();

        // Delete objects from the end of the list using method removeFromBack
        removedObject = list.removeFromBack();
        System.out.printf( "%s removed\n", removedObject );
        list.print();

    } // end main
} // end class ListTest

