26 February 2014

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.

No comments:

Post a Comment