Java EE, JPA, JSF, CDI...
Karsten Wutzke wrote:What about standard hashing functions like MD5, SHA1, CRC, and Adler?
[My Blog]
All roads lead to JavaRanch
Christophe Verré wrote:PS: hashCode is not used to generate unique integers
Java EE, JPA, JSF, CDI...
Christophe Verré wrote:
Karsten Wutzke wrote:What about standard hashing functions like MD5, SHA1, CRC, and Adler?
Encoding ? You don't use encoding for a hashCode. If you don't want to make the hashCode yourself, there's a nifty class in Apache Commons Lang which helps you do that : org.apache.commons.lang.builder.HashCodeBuilder
Java EE, JPA, JSF, CDI...
Mike Simmons wrote:Remember that if you're overriding hashCode() you need to override equals() as well. HashCodeBuilder is accompanied by EqualsBuilder
Personally, I like Pojomatic, which handles hashCode(), equals(), and also toString() with a minimum of fuss.
Java EE, JPA, JSF, CDI...
Java EE, JPA, JSF, CDI...
Karsten Wutzke wrote:Thanks for the information. Is performance an issue on using reflection-based builders?
Consider Paul's rocket mass heater. |