title: Java generic function for performing calculations on integer, on double?
body: <p>Is this possible? Surely if you passed in a double, any sort of function implementation code which casts an object to an Integer would not be able to work unless the cast 'Integer' was specifically used? I have a function like:</p>
  
  <pre><code>public static void increment(Object o){
      Integer one = (Integer)o;
      system.out.println(one++);
  }
  </code></pre>
  
  <p>I cant see how this could be made generic for a double? I tried</p>
  
  <pre><code>public static &lt;E&gt; void increment(E obj){
      E one = (E)obj;
      system.out.println(one++);
  }
  </code></pre>
  
  <p>but it didn't like it?</p>