Why Caches with Immutable Classes?

Why do immutable classes have some kind of cache associated with them?

KRISHNA KISHORE V

--

Fig 1. The Integer Cache anomaly

Have you ever wondered about the implications of careless designs of Immutable classes and why the immutable classes have an associated cache? Read this article till the end and take your knowledge a little up about immutable classes. And also know about the reasons behind the flyweight

--

--

KRISHNA KISHORE V

Full Stack Tech Lead | Software Consultant | Technical Content Writer