title: Eliminate unchecked warning: cast String to T
body: <p>Following method which returns a list with a dynamic type parameter:</p>
  
  <pre><code>public List&lt;T&gt; getDataList() throws SQLException {
    List&lt;T&gt; l = new ArrayList&lt;T&gt;();
    l.add((T) "Test");
    return l;
  }
  </code></pre>
  
  <p>This gives me an unchecked cast warning.</p>
  
  <p>If I change the code to:</p>
  
  <pre><code>public List&lt;T&gt; getDataList() throws SQLException {
    List&lt;String&gt; l = new ArrayList&lt;String&gt;();
    l.add("Test");
    (List&lt;T&gt;) return l;
  }
  </code></pre>
  
  <p>it is nearly the same. I get a unchecked cast warning.</p>
  
  <p><strong>Question:</strong></p>
  
  <p>Is it possible to eliminate this unchecked warning without loosing flexibility of getDataList method?</p>