An effective way of overriding hashCode() in Java


This class enables a good hashCode method to be built for any class. It follows the rules laid out in the book Effective Java by Joshua Bloch. 

Shall I say any more? This is from Apache Commons. It is using the Builder Design Pattern.

Comparison between Apache Commons and Guava implementation of HashCodeBuilder can be a good follow up reading material.

Leave a Reply

Your email address will not be published. Required fields are marked *