//Konstantin Voevodski, Lab3 CAS CS112 Spring 2010 //a main that uses the generic LinkedList implementation import java.util.*; public class genericListClient { public static void main(String[] args) //we use same generic class to create a linked list of Integer and a linked list of Double { Random g = new Random(1); myLinkedList list1 = new myLinkedList(); //list1 holds Integer objects for(int x = 0; x < 20; x++){ list1.add(g.nextInt()); } System.out.println("contents of list containing integers:"); for(int x = 0; x < list1.size(); x++){ System.out.println(list1.get(x)); } myLinkedList list2 = new myLinkedList(); //list2 holds Double objects System.out.println("contents of list containing doubles"); for(int x = 0; x < 20; x++){ list2.add(g.nextDouble()); } for(int x = 0; x < list2.size(); x++){ System.out.println(list2.get(x)); } //note: you cannot add doubles to list1, or ints to list2 } }