title: In generic method <T> doSth(List<T> l), check whether T implements Comparable?
body: <p>The title basically says it all: if I have a java method that is generic in T, can I find out anything about T?  In particular, can I check whether T implements a certain interface or extends a certain class?</p>
  
  <p>I would like to do something like</p>
  
  <pre><code>public &lt;T&gt; List&lt;T&gt; doSth(List&lt;T&gt; l) {
  
    if(T extends Comparable) {
      // do one thing
    } else {
      // do another
    }
  
    return l;
  }
  </code></pre>
  
  <p>Any hints?</p>
  
  <p>Thanks a lot,</p>
  
  <p>Johannes</p>