title: Java unchecked method invocation with ArrayList
body: <p>When I run my code I get this warning: </p>
  
  <pre><code>warning: [unchecked] unchecked method invocation: method addAll in interface List is applied to given types
          snakeDotlist.addAll(genFirstDots());
    required: Collection&lt;? extends E&gt;
    found: List
    where E is a type-variable:
      E extends Object declared in interface List
  </code></pre>
  
  <p>code:</p>
  
  <pre><code>initDisplay();
  
      List&lt;Sprite&gt; snakeDotlist = new ArrayList&lt;&gt;();
      snakeDotlist.addAll(genFirstDots());
  
  
  
      Sprite tokenSprite = new Sprite((genRandomNumber(0, 64)), (genRandomNumber(0, 48)), 16, 16, "res/snakedot.png");
  
      while(!Display.isCloseRequested())
      {
  
          if (hasCollided(tokenSprite, snakeDotlist.get(0)))
          {
              tokenSprite.updateToken(true);
              snakeDotlist.get(0).score += 1;
              snakeDotlist.addAll(genNewDots((int)snakeDotlist.get(0).prev1x, (int)snakeDotlist.get(0).prev1y, (int)snakeDotlist.get(0).prev2x, (int)snakeDotlist.get(0).prev1y));
          }
  </code></pre>
  
  <p>.</p>
  
  <pre><code> public static List genFirstDots()
  {
      List&lt;Sprite&gt; list = new ArrayList&lt;&gt;();
      list.add(new Sprite(3, 0, 16, 16, "res/snakedot.png"));
      list.add(new Sprite(2, 0, 16, 16, "res/snakedot.png"));
      list.add(new Sprite(1, 0, 16, 16, "res/snakedot.png"));
      list.add(new Sprite(0, 0, 16, 16, "res/snakedot.png"));
      return list;
  }
  </code></pre>
  
  <p>I looked at a few other posts that said to change the declaration of snakeDotList from </p>
  
  <pre><code>List&lt;Sprite&gt; snakeDotlist = new ArrayList&lt;Sprite&gt;();
  </code></pre>
  
  <p>to</p>
  
  <pre><code>List&lt;Sprite&gt; snakeDotlist = new ArrayList&lt;&gt;();
  </code></pre>
  
  <p>but I still get the warning messages and I don't know how to solve it, any help?</p>