Immutable

An immutable object is one whose content cannot be changed. An object can be immutable for various reasons, for example:

  • To improve performance (no planning for the object's future changes)
  • To reduce memory use (make object references instead of cloning the whole object)
  • Thread-safety (multiple threads can reference the same object without interfering with one other)

See also