title: The expression of type List needs unchecked conversion to conform to List<Student>, when using Hibernate Criteria
body: <p>I have this piece of code that gives the warning mentioned in the title:</p>
  
  <pre><code>List&lt;Student&gt; studentList = session.createCriteria(Student.class)
      .add(Restrictions.eq("indexNumber", indexNum))
      .list();
  </code></pre>
  
  <p>I've read the thread <a href="https://stackoverflow.com/questions/367626/how-do-i-fix-the-expression-of-type-list-needs-unchecked-conversion">How do I fix &quot;The expression of type List needs unchecked conversion...&#39;?</a> and there's a great solution by @BrunoDeFraine:</p>
  
  <pre><code>public static &lt;T&gt; List&lt;T&gt; castList(Class&lt;? extends T&gt; clazz, Collection&lt;?&gt; c) {
      List&lt;T&gt; r = new ArrayList&lt;T&gt;(c.size());
      for(Object o: c)
        r.add(clazz.cast(o));
      return r;
  }
  </code></pre>
  
  <p>then I can just do this:</p>
  
  <pre><code>List&lt;SyndEntry&gt; entries = castList(SyndEntry.class, sf.getEntries());
  </code></pre>
  
  <p>This works great, but in my case I have Criteria as argument, not class and collection.
  My question is, can this method be adapted to have criteria as argument, or should I simply use @SuppressWarnings("unchecked")?</p>