Source of GenericDemo.java


  1: 
  2: import java.util.*;
  3: 
  4: public class GenericDemo
  5: {
  6:    public static void main(String[] args)
  7:    {
  8:       LinkedList<String> stringList = new LinkedList<String>( );
  9:       stringList.addANodeToStart("Hello");
 10:       stringList.addANodeToStart("Good-bye");
 11:       stringList.showList( );
 12:   
 13:       LinkedList<Integer> numberList = 
 14:                                 new LinkedList<Integer>( );
 15:                                 
 16:       int i;
 17:       for (i = 0; i < 10; i++)
 18:            numberList.addANodeToStart(i);
 19:        Vector<Integer> v = numberList.vectorCopy( );
 20:        int position;
 21:        int vectorSize = v.size( );
 22:        for (position = 0; position < vectorSize; position++)
 23:            System.out.println(v.elementAt(position));
 24:     }
 25: }