title: Null Safe Compare two bigdecimal objects having 0.0 and 0
body: <p>Initially code was :</p>
  
  <pre><code>            if(!Objects.equals(src.getApplicationItemCost(), dest.getApplicationItemCost())){
                 log.info("Difference")
              }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>      getApplicationItemCost: src:0.0| dest:0
        Difference
  </code></pre>
  
  <p>ApplicationItemCost is of type BigDecimal.</p>
  
  <p>If I use <code>compareTo</code> then I have to explicitly check nulls like :</p>
  
  <pre><code>LOG.info("getApplicationItemCost: src:" + src.getApplicationItemCost() + "| dest:" + dest.getApplicationItemCost());
          if((src.getApplicationItemCost()==null &amp;&amp; dest.getApplicationItemCost()!=null)
                  || (src.getApplicationItemCost()!=null &amp;&amp; dest.getApplicationItemCost()==null)
                  || !Objects.equals(src.getApplicationItemCost(), dest.getApplicationItemCost())
                  || src.getApplicationItemCost().compareTo(dest.getApplicationItemCost())!=0 )
  </code></pre>
  
  <p>Any suggestion to compare 0.0 and 0. Why is this difference? (May be database has Number field and when converted to big decimal it does not show 0.0?)</p>