Is it possible to change IntelliJ's code generation template for equals() and hashCode()

Mike Rylander picture Mike Rylander · Aug 21, 2013 · Viewed 12k times · Source

Is it possible to change the code generation template for equals() and hashCode()?

I would like the generated code to use the Java 7 Objects class for theses methods.

Answer

datentyp picture datentyp · Mar 25, 2015

As of release 14.1 of the Ultimate Edition it is possible to customize the Code generation template of equals()/hashCode() without the use of any third party plugin.

Press "Alt + Insert" (Generate...), choose "equals() and hashCode()" and you will be able to select one of the predefined templates or a customized template of your own.

"Generate equals() and hashCode()" dialog

Edit "equals() and hashCode()" Velocity templates