title: Clean way of avoiding NullPointerException in equals checks
body: <p>I have an address object that I want to create an equals method for. I could have made this quite simple by doing something like the following (shortened a bit):</p>
  
  <pre><code>public boolean equals(Object obj) 
  {
      if (this == obj)
          return true;
  
      if (obj == null)
          return false;
  
      if (getClass() != obj.getClass())
          return false;
  
      Address other = (Address) obj;
  
      return this.getStreet().equals(other.getStreet())
          &amp;&amp; this.getStreetNumber().equals(other.getStreetNumber())
          &amp;&amp; this.getStreetLetter().equals(other.getStreetLetter())
          &amp;&amp; this.getTown().equals(other.getTown());
  }
  </code></pre>
  
  <p>Problem is, some of these might be null. I will in other words get a <code>NullPointerException</code> if there is no street letter in this address.</p>
  
  <p>How can I write this in a clean way while taking null values into account?</p>