IntelliJ IDEA 13.1 Web Help

Code | Generate | context menu | equals() and hashCode()
Alt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertCtrl+N or Alt+InsertAlt+InsertAlt+InsertCommand N or Control EnterControl N or Control EnterCommand N or Control Enter | context menu | equals() and hashCode()

Use this wizard to generate equals() and hashCode() methods.

Item Description
Accept subclasses as parameter to equals() method While generally incompliant to Object.equals() specification accepting subclasses might be necessary for generated method to work correctly with frameworks, which generate Proxy subclasses like Hibernate.
Choose fields to be included in equals() Select the fields that should be used to determine equality. Each of the selected field's values will be compared, and objects will be considered equal only if all the field values specified here are equivalent.
Choose fields to be included in hashCode() Select the fields to generate hash code. Note, that only the fields that were included in the equals() method, can participate in creating hash code. All these fields are selected by default, but you can deselect them, if necessary.
Select all non-null fields This page appears if any of the chosen fields are of non-primitive type in order to avoid generation of unnecessary checks. In other words, if a check box for any of these fields is selected, it is presumed that such field never has a null value and such check will not be included into generated methods.

See Also

Procedures:

Web Resources: