// GMDemo.java

import java.util.*;

class GMDemo
{
   public static void main (String [] args)
   {
      String [] names = { "George", "Jane", "Joel" };

      List<Object> l = new ArrayList<Object>();

      fromArrayToCollection (names, l);

      printCollection (l);

      List<String> l2 = new ArrayList<String>();

      fromArrayToCollection2 (names, l2);

      printCollection2 (l2);
   }

   static void fromArrayToCollection (Object [] a, Collection <Object> c)
   {
      for (Object o: a)
           c.add (o);
   }

   static <T> void fromArrayToCollection2 (T [] a, Collection<T> c)
   {
      for (T o: a)
           c.add (o);
   }

   static void printCollection (Collection<Object> c)
   {
      for (Object e: c)
           System.out.println (e);
   }

   static void printCollection2 (Collection<?> c)
   {
      for (Object e: c)
           System.out.println (e);
   }
}
