title: How to teach eclipse to generate compact equals() and hashCode() from the jdk 7 Objects class?
body: <p>Some days ago we switched to Java 7 within my Company - finally! Jay \o/ So I found out about the <code>Objects</code> class and was astonished how short the methods <code>hashCode()</code> and <code>equals()</code> were realized, reducing a lot of boylerplate code compared to the ones generated by eclipse per default (ALT+SHIFT+S --> H).</p>
  
  <p>I was wondering if I could change the default behaviour of the eclipse generated <code>hashCode()</code> and <code>equals()</code>?</p>
  
  <p>I'd love to see this:</p>
  
  <pre><code>@Override
  public int hashCode()
  {
    return Objects.hash(one, two, three, four/*, ...*/);
  }
  </code></pre>
  
  <p>instead of this:</p>
  
  <pre><code>@Override
  public int hashCode()
  {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((one == null) ? 0 : one.hashCode());
    result = prime * result + ((two == null) ? 0 : two.hashCode());
    result = prime * result + ((three == null) ? 0 : three.hashCode());
    result = prime * result + ((four== null) ? 0 : four.hashCode());
    // ...
    return result;
  }
  </code></pre>
  
  <p>The same goes for <code>equals()</code>. <a href="http://www.javaworld.com/community/node/8014">This is the article</a> I got this from.</p>
  
  <p>Any ideas how to realize this best?</p>