Immutable objects in Java. The main aim and usage.

Stonehenge

What are immutable objects in Java Immutable objects are multifunctional objects that can be used in different parts of the program. For example,  immutable objects can be in a multithreaded environment for working with data. They can also be complex constants that help you avoid unnecessary memory usage and garbage collector overloading. Separately we should mention immutability when working with collections. The main parameters of immutable classes Saying that a class is immutable, it must correspond to the following criteria: Do not provide methods that modify the object’s state. These…

Read More