Created
October 30, 2015 02:19
-
-
Save jarrad/518cacb027d86a49780c to your computer and use it in GitHub Desktop.
Insert a basic equals method into your class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
${:import(java.util.Objects)} | |
@Override | |
public boolean equals(Object obj) { | |
if (obj == null) { | |
return false; | |
} | |
if (!(obj instanceof ${enclosing_type})) { | |
return false; | |
} | |
${enclosing_type} other = (${enclosing_type}) obj; | |
return Objects.equals(${var}, other.${var}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment