Will an immutable class of my own implementation result in memory savings? That is, if two references need to refer to identical instances, they will reference the same instance even if there are two separate attempts to allocate the object. This is a Java question.
Will an immutable class of my own implementation result in memory savings? That is,
Share
Not immutability, but your design to make two references reference the same instance is what “saves” memory. Immutability is independent of that decision.