SDSU CS 596
Fall Semester, 1998
Assignment 3 Test Data
To Assignment Index
San Diego State University -- This page last updated 12-Oct-98

Create two empty SortedLinkedList object. Call one "stringList" which will sort strings. Call the other integerList, which will sort Integers. Perform the
following tests. You may change the way the tests create the lists if your code does not create the lists as done below.

Test One

public static void TestOne() throws CloneNotSupportedException
     {
     SortedLinkedList stringList = 
          new SortedLinkedList( StringComparer.getInstance() );
     System.out.println( "Empty String list :  " + stringList );
     stringList.add( "d" );
     stringList.add( "a" );
     stringList.add( "f" );
     stringList.add( "b" );
     stringList.add( "e" );
     System.out.println( "Full String list :  " + stringList );

     System.out.print( "Enumeration on String list :  " );
     Enumeration list = stringList.elements();
     while ( list.hasMoreElements() )
          System.out.print( "" + list.nextElement() + "\t" );
     System.out.println( );

     SortedLinkedList aClone =(SortedLinkedList) stringList.clone();
     stringList.add( "c" );
     System.out.println( "Clone :  " + aClone );
     System.out.println( "Changed string list :  " + stringList );
     }

Test Two

public static void TestTwo()
     {
     SortedLinkedList integerList = 
          new SortedLinkedList( IntegerComparer.getInstance() );
     System.out.println( "Empty Integer list :  " + integerList );
     integerList.add(  new Integer( 9) );
     integerList.add(  new Integer( 7) );
     integerList.add(  new Integer( 5) );
     integerList.add(  new Integer( 3) );
     integerList.add(  new Integer( 1) );
     System.out.println( "Full Integer list :  " + integerList );
     }

Copyright © 1998 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
All rights reserved.

visitors since 12-Oct-98