Paweł Chudzik 10/19/2016

Consistent return of hashCode in java

Read Original

This technical article delves into the Java hashCode() contract, specifically the requirement for consistent return values. It warns developers against auto-generating equals() and hashCode() without understanding the consequences, demonstrating how mutable fields can break collections like HashSet. The author provides code examples to illustrate the pitfalls of inconsistent hash codes.

Consistent return of hashCode in java

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week