Immutable interface

[1] The immutable interface pattern involves defining a type which does not provide any methods which mutate state.

Objects which are referenced by that type are not seen to have any mutable state, and appear immutable.

The class Point2D is mutable: its state can be changed after construction, by invoking either of the setter methods (setX() or setY()).

This is demonstrated in the following example: By referencing only the immutable interface, it is not valid to call a method which mutates the state of the concrete object.

Persistent data structures are effectively immutable while allowing modified views of themselves.