title: How to get class with generics types in Java
body: <p>I am trying to make a method call like this,</p>
  
  <pre><code>public class GenericsTest&lt;T&gt; {
  
      public static &lt;T&gt; Map&lt;String, T&gt; createMap(Class&lt;? extends Map&lt;String, T&gt;&gt; clazz) {
          return null;
      }
  
      public static void main(String[] argv) {
          Map&lt;String, Integer&gt; result = createMap(TreeMap.class);
      }
  }
  </code></pre>
  
  <p>But I am getting this error,</p>
  
  <pre><code>&lt;T&gt;createMap(java.lang.Class&lt;? extends java.util.Map&lt;java.lang.String,T&gt;&gt;) in test.GenericsTest&lt;T&gt; cannot be applied to (java.lang.Class&lt;java.util.TreeMap&gt;)
  </code></pre>
  
  <p>How to fix this problem?</p>