title: How to have Java method return generic list of any type?
body: <p>I would like to write a method that would return a <code>java.util.List</code> of any type <strong>without the need to typecast anything</strong>:</p>
  <pre><code>List&lt;User&gt; users = magicalListGetter(User.class);
  
  List&lt;Vehicle&gt; vehicles = magicalListGetter(Vehicle.class);
  
  List&lt;String&gt; strings = magicalListGetter(String.class);
  </code></pre>
  <p>What would the method signature look like? Something like this, perhaps(?):</p>
  <pre><code>public List&lt;&lt;?&gt; ?&gt; magicalListGetter(Class&lt;?&gt; clazz) {
      List&lt;?&gt; list = doMagicalVooDooHere();
  
      return list;
  }
  </code></pre>