November 22, 2018

How to cache hashcodes in an immutable class.

We can keep a member variable to store hashcode for the created object. And we will return that variable whenever, a user asks for hashcodes. Here, in this article, we will use a class which is an immutable class. In the below class, I use hashcode instance variable to store the hashcode. Hashcode for a given object […]

Read more