title: Does Java provide an equals method which takes two parameters
body: <p>In each equals method I need to write a block like this for every (relevant) attribute:</p>
  
  <pre><code>@Override
  public boolean equals(Object obj) {
    ...
    if (member1 == null) {
      if (other.member1 != null) {
        return false;
      }
    } else if (!member1.equals(other.member1)) {
      return false;
    }
    ...
    return true;
  }
  </code></pre>
  
  <p>This is every time the same without any benefit just to avoid NullPointerExceptions.</p>
  
  <p>Wouldn't it be much nicer just to call </p>
  
  <pre><code>boolean doesIt = SomeClass.equals( member1, other.member1);
  </code></pre>
  
  <p>This method would check if both are null and if not it calls the default equals on member1.</p>
  
  <p>That would mean my equals method could at the end look like this</p>
  
  <pre><code>@Override
  public boolean equals(Object obj) {
    return obj != null
           &amp;&amp; getClass() == obj.getClass()
           &amp;&amp; SomeClass.equals(member1, (((XX) other).member1)
           &amp;&amp; SomeClass.equals(member2, (((XX) other).member2)
           &amp;&amp; SomeClass.equals(member3, (((XX) other).member3)
           &amp;&amp; SomeClass.equals(member4, (((XX) other).member4);
  }
  </code></pre>
  
  <p>Much clearer and less error prone in my eyes.</p>
  
  <p>Of course there is absolutely no problem writing this class/method on my own but I would like to know if there is possibly already a class which provides equals(Object, Object).</p>