我们的志愿者还没有将这篇文章翻译为 中文 (简体)。加入我们帮助完成翻译!
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)
Learn more
General knowledge
- Immutable on Wikipedia