title: How do I compare classes using reflection?
body: <p>I am trying to determine the class type of a class using reflection and then do something specific. For example, if the class is a double, use a double specific method.</p>
  
  <p>I am attempting to use</p>
  
  <pre><code>
    if(f.getClass() == Double.class)
  </code></pre>
  
  <p>However, I am getting a compiler error:</p>
  
  <p>"Incompatible operand types Class &lt;capture#1-of ? extends Field&gt; and Class&lt;Double&gt;"</p>
  
  <p>What is the proper way to do this? </p>
  
  <p>Edit: to be more clear</p>
  
  <p>f is of type Field. obtained by reflection in a loop </p>
  
  <pre><code>
    (Field f : instance.getDeclaredFields())
  </code></pre>