If you are using Eclipse it has integrated a very cool hashCode() / equals() generator. You just have to be on a class and do: right click > Source code > Generate hashCode() and equals().
Then, a window will show up and you can choose the fields to include in your methods.