title: How to overload a method with generic parameter in java?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7201231/java-erasure-with-generic-overloading-not-overriding">Java erasure with generic overloading (not overriding)</a>  </p>
  </blockquote>
  
  
  
  <p>How to overloading method with generic parameter in java?</p>
  
  <p>Say I have following class</p>
  
  <pre><code>import java.util.List;
  
  public class C {
  
      public void foo(List&lt;String&gt; a){
  
      }
  
      public void foo(List&lt;Integer&gt; b){
  
      }
  
  }
  </code></pre>
  
  <p>This gives compilation error and rightly so as erasure is doing it's job and removing the type information, so after compilation both the methods will have same parameter of list only.</p>
  
  <p>If I don't want to use </p>
  
  <pre><code>public void foo(List&lt;T&gt; a){
  
  }
  </code></pre>
  
  <p>Is there any other way to overload the method foo()?</p>