title: How do I add generic items to a generic ArrayList?
body: <p>I have an assignment which requires me to implement a generic priority queue from scratch, however I'm getting an error that I don't think makes any sense.</p>
  
  <pre><code>public class PriorityQueue&lt;E&gt; {
       private ArrayList&lt;E&gt; items = new ArrayList&lt;E&gt;(0);
       ...
       public &lt;E extends Comparable&lt;E&gt;&gt; void insert(E newItem){
  
         if(numOfItems == 0){
            items.add(newItem); //ERROR: The method add(E) in the type ArrayList&lt;E&gt; 
                                         is not applicable for the arguments (E)
            rear++;
            numOfItems++;
         }else{
              //INCOMPLETE
         }
      }
  }
  </code></pre>