title: Unchecked warnings for Arraylist
body: <p>Why am I getting these 4 warnings from -Xlint and what should I do about them? I'm just starting in Java, so am likely missing something obvious.</p>
  
  <pre><code>import java.util.*;
  
  class CompareGerbils implements Comparator {
      public int compare(Object o1, Object o2) {
         return ((Gerbil)o2).number() - ((Gerbil)o1).number();
      }
  }
  
  class Gerbil {
  int gerbilNumber;
  
  Gerbil(int gN) {
      gerbilNumber = gN;
      }
  
  int number() {
      return gerbilNumber;
      }
  }
  
  public class lt {
      public static void main(String[] args) { 
  
      // I'd like to be able to add both ints and strings to list
      ArrayList list = new ArrayList();
  
      //unchecked call warning:
      list.add(1);  
  
      //unchecked call warning:
      list.add("b");  
  
      ArrayList&lt;Gerbil&gt; gerbillist = new ArrayList&lt;Gerbil&gt;();
  
      for(int i = 0; i &lt; 5; i++) {
          gerbillist.add(new Gerbil(i));
      }
  
      //unchecked conversion warning
      //unchecked method invocation
      Collections.sort(gerbillist, new CompareGerbils());
    }
  }
  </code></pre>
  
  <p>EDIT: replies so far have answered the Arraylist declaration.  How about the sort warnings at the bottom of the code?  thanks</p>