title: If final object is being passed, should null still be checked?
body: <p>Check out the following code:</p>
  
  <pre><code>    @Override
      public int compareTo(final Intersection o) {
          if (o == null) 
              return 0;
  
          double distance = t;
          double distance2 = o.t;
  
          if (distance == distance2) 
              return 0;
  
  
          return distance2 &gt; distance ? -1 : 1;
      }
  </code></pre>
  
  <hr>
  
  <p>All seems well however the fact that 0 may be returned on two different conditional occasions does somewhat bother me. If I do however move the variable assignments of <code>distance</code> and <code>distance2</code> to the top, my IDE warns me that</p>
  
  <pre><code>            if (o == null) 
                return 0;
  </code></pre>
  
  <p>Would then be 'dead' code. If that's the case, should null even be checked in this scenario?</p>
  
  <hr>
  
  <p>What I mean is:</p>
  
  <pre><code>@Override
      public int compareTo(final Intersection o) {
  
          double distance = t;
          double distance2 = o.t;
  
          if (o == null) 
              return 0;
  
          if (distance == distance2) 
              return 0;
  
  
          return distance2 &gt; distance ? -1 : 1;
      }
  </code></pre>