Hi devs, Most Object#hashCode() are implemented using HashCodeBuilder. HashCodeBuilder provide an empty constructor and also allow setting "random" numbers.
http://dev.xwiki.org/xwiki/bin/view/Community/JavaCodeStyle#HEquals2FHashCodeandToStringimplementations does not really say anything about what do do and when currently so I would like to have a clear rule about it. On my side when I don't plan to use different types of objects in a hash key I usually simply use the empty HashCodeBuilder constructor. The only point of setting different numbers is when you might end up comparing different object types (and even in that case you have the #equals() safeguard anyway so it's mostly about performances in practice). So here is a proposal: it's OK to use empty HashCodeBuilder constructor except: * when overwriting the hachCode of a super class you should use different numbers than the super class (since there is big chance to have that super class used as a hash key) * as a best effect in general if you know that you are going to have several different types as hash key, try to make sure they use different random numbers, your proc will thank you :) WDYT ? -- Thomas Mortagne

