title: Java generics put String or Integer argument in method
body: <p>I want to make something like this. How I can do this pretty in java with generics?</p>
  
  <pre><code> public &lt;T [Integer or String]&gt; Float getFloat(&lt;T&gt; column) throws SQLException{
      Float result;
  
      try {
          result = ResultSet.getFloat(column);
      } catch (NullPointerException e) {
          result = null;
      }
      return result;
  }
  </code></pre>
  
  <p>Now my code looks like this:</p>
  
  <pre><code>public Float getFloat(String column) throws SQLException{
      Float result;
  
      try {
          result = rs.getFloat(column);
      } catch (NullPointerException e) {
          result = null;
      }
      return result;
  }
  public Float getFloat(int column) throws SQLException{
      Float result;
      try {
          result = rs.getFloat(column);
      } catch (NullPointerException e) {
          result = null;
      }
      return result;
  }
  </code></pre>
  
  <p>I do this because method rs.getFloat() may receive String (Column label) &amp; Integer (Column Index) only. But this not important for my method.</p>