In this mini Fragment, we introduce Joshua’s ninth Item. After the last somewhat mind boggling item, this is a much welcomed simple, practical yet important one: Always override hashCode when you override equals.
Donn goes into the importance of implementing hashCode and why it’s so important to override it for maintaining harmony with the equals method. Also 42 and the answer to life ? He then goes into some tips on implementing a good hashCode and a standard recipe for the same.
Go forth and override them hashCodes!
This episode is brought to you by Rollbar. Go to rollbar.com/fragmented to get their Bootstrap plan for free for 90 days. Stay tuned for more items from our “Effective Java for Android developers” Fragment series.