Equals and HashCode Deluxe Generator

Compatible with  IntelliJ IDEA
34 486
Generates equals() and hashCode() using Guava library or Objects class from Java 7. Usage:
  • ALT + INSERT -> equals() and hashCode() deluxe (inside Java Editor).

Download plugin

Recent change notes

version 1.0.12
version 1.0.11
version 1.0.10
version 1.0.9
version 1.0.8
version 1.0.7
  • Fixed bug with incorrect class name shown when asking about permission to delete existing equals/hashCode methods
version 1.0.6
version 1.0.5
  • Added ability to choose between Java 7 and Guava
version 1.0.4
  • Added comparison with base class fo subclasses in equals method
version 1.0.3
  • Fixed compatibility issue with IDEA 12
version 1.0.2
  • Tested against IDEA 10.5
version 1.0.1
  • Changed plugin name as slash character ('/') caused a bug with download link on JetBrains site.

General usage instructions

ALT + INSERT -> equals() and hashCode() deluxe (inside Java Editor)
Great plugin. Please use Objects.deepEquals() by default for arrays!
Nice. Would appreciate if it imported java.util.Objects out of the box when Java7 style was chosen.
This is great, but is it possible to allow configuration of the style of the equals() method? I personally like to use the following concise style: public boolean equals(Object obj) { if (obj instanceof MyClass) { final MyClass that = (MyClass) obj; return equal(this.field1, that.field1) && equal(this.field2, that.field2) && equal(this.field3, that.field3); } return false; }
nice one. Also check out http://muhammadkhojaye.blogspot.com/2010/02/java-hashing.html‎ for more comprehensive example.
Makes life a lot easier
Not bad and does what it should. However, the first dialog in the wizard should have select/unselect all in case one needs to base equals on a single id for instance. Also there is no customization in case you prefer something like: return this == obj || obj != null && getClass() == obj.getClass() && Objects.equal(getPrimaryKey(), ((ConfigData) obj).getPrimaryKey()); ...instead of typical ifs, braces, many lines, etc.
Please  sign in  to leave a comment.