Posted by jkwarren on Feb 02 2010 in Blather
HashCode: Forgot My Own Advice
Some time ago I wrote a little bit on the Java equals-hashCode contract. Recently, I hastily violated this, and have spent the last two days chasing down failures in my refactoring due to this violation.
To be fair, I wasn't done yet, and would like to think that I certainly would have properly implemented hashCode() to go along with my developing equals() in my code. I'm a little, shall we say "particular" about such things, and am very certain I would have.
What I'm surprised (and frustrataed) at myself for is not realizing this was my problem. I would normally create my equals() and hashCode() at the same time, but, for whatever reason, this time I did not.
Now I'm back on track...and kicking myself...gently, of course.