title: if(x!=y) vs if(x==y)
body: <p>I have run the <a href="http://pmd.sourceforge.net/">PMD plugin</a> in Eclipse against my code and I'm getting a high priority warning for  code similar to the one shown below:</p>
  
  <pre><code> if(singleRequest !=null){
     // do my work
   }else{
     // do my other work
   }
  </code></pre>
  
  <p>PMD says <code>`Avoid if (x != y) ..; else ..</code>;</p>
  
  <p>And the description of the error looks like this:</p>
  
  <pre><code>In an "if" expression with an "else" clause, avoid negation in
  the test.  For example, rephrase:
  if (x != y) diff(); else same();
  as:
  if (x == y) same(); else diff();
  Most "if (x != y)" cases without an "else" are often return
  </code></pre>
  
  <p>but I still can't understand the impact  on my code. If someone could guide me with an example, I would appreciate it. </p>