001package horstmann.ch07_generic;
002import java.awt.Polygon;
003import java.awt.Rectangle;
004import java.awt.Shape;
005import java.util.ArrayList;
006import java.util.GregorianCalendar;
007
008public class UtilsTester
009{
010        public static void main(String[] args)
011                        throws InstantiationException, IllegalAccessException
012        {
013                ArrayList<String> ids = new ArrayList<String>();
014                Utils.fill(ids, "default", 10);
015                System.out.println(ids);
016
017                ArrayList<Shape> shapes = new ArrayList<Shape>();
018                Utils.fill(shapes, new Rectangle(5, 10, 20, 30), 2);
019                System.out.println(shapes);
020
021                ArrayList<Polygon> polys = new ArrayList<Polygon>();
022                Utils.fillWithDefaults(polys, Polygon.class, 10);
023                Utils.append(shapes, polys, 2);
024                System.out.println(shapes);
025
026                ArrayList<GregorianCalendar> dates
027                = new ArrayList<GregorianCalendar>();
028                Utils.fillWithDefaults(dates, GregorianCalendar.class, 5);
029                System.out.println(Utils.getMax(dates));
030        }
031}