immutable | - Ensure that the constructor of the immutable class is the only place where the values of instance variables are set or modified.
- If a method that would otherwise modify an instance variable must be present, then it has to return a new instance of the class.
| Read-Only Interface pattern provides the same capability as immutable, except that certain privileged classes are allowed to make changes to instances. | | html>- The immutability must be enforced.
- There must be no loopholes that would allow 'illegal' modification of an immutable object.
| How do you create a class whose instances are immutable? | A pattern in which the instances of a class cannot change state after creation | 6.10 - The Immutable Pattern | | design pattern |