Yet Another Equals x Hashcode Article
There are tons of articles about Java equals and hashcode implementation. Why another one? My first attempt: Because almost every developer uses the automatic filling of Object#equals(Object) and Object#hashCode() through their favorite IDE without truly understanding its role within the application. To make it more like a black box from JDK 7 onwards the programmer can just use the Objects utility class like this: @Override public int hashCode(){ return Objects.hash(firstName, lastName); } In an old post of this blog someone wrote several equals implementations demonstrating how useful the Objects class is, indeed. »