title: ArrayList of generic objects in java. Unchecked call to 'Class(T)' as a member of raw type 'Class'
body: <p>I have the following piece of code:</p>
  
  <pre><code>public class Coordinate&lt;T&gt;{
  T coordinate;
  //rest of class
  }
  </code></pre>
  
  <p>and then i later try to create an ArrayList which contains various Coordinates like so:</p>
  
  <pre><code>ArrayList&lt;Coordinate&gt; location = new ArrayList&lt;Coordinate&gt;();
  </code></pre>
  
  <p>and finally i add some coordinates to the location</p>
  
  <pre><code>location.add(new Coordinate(0));
  location.add(new Coordinate("A"));
  location.add(new Coordinate(0.1f));
  </code></pre>
  
  <p>these location.add() calls gives me the following warning: </p>
  
  <blockquote>
    <p>Unchecked call to 'Coordinate(T)' as a member of raw type 'Coordinate'</p>
  </blockquote>
  
  <p>I have searched for this warning and found some hits, but i was not able to figure out from those answers how i could make my application work, because i would like the ArrayList location to be able to hold different types of Coordinates, so i cant do something like</p>
  
  <p><code>ArrayList&lt;Coordinate&lt;Integer&gt;&gt; location = new ArrayList&lt;Coordinate&lt;Integer&gt;&gt;();</code>. </p>
  
  <p>Perhaps I'm just going about the problem in the wrong way?</p>
  
  <p>Thanks in advance.</p>