title: Java: Check variable type
body: <p>I'm working on an assignment where I have to sort integers and string type variables.</p>
  
  <p>So I have a method declared as </p>
  
  <pre><code>public void quickSort(ArrayList&lt;Entry&lt;Integer, String&gt;&gt; list) {
  </code></pre>
  
  <p>but if I want to overload the method and use </p>
  
  <pre><code>public void quickSort(ArrayList&lt;Entry&lt;String, Integer&gt;&gt; list) {
  </code></pre>
  
  <p>It is recognized as a duplicate.</p>
  
  <p>Is there a way to check what my variable types are? 
  Alternatively, is there a way to sort strings and integers the same way so that I can do something like</p>
  
  <pre><code>public void quickSort(ArrayList&lt;Entry&lt;K, V&gt;&gt; list) {
  </code></pre>
  
  <p>that will work on both date types?</p>