摘要: 如果一个对象在创建之后,其内容不能更改, 则成为不可变对象(immutable object)它的类称为不可变类(immutable class)一个类即便所有数据域都是私有的,而且没有更改器函数,也不一定是不可变类。
基于104个网页-相关网页
不可变类型 immutable type ; Immutable sequences
可变类和不可变类 Mutable and Immutable Objects
使用不可变的值类型 Immutable Atomic Value Types
不可变基本类型 imutable basic types
外翻变形,不可归类在他处者 Valgus deformity, not elsewhere classified
老年性脑变性,不可归类在他处者 Senile degeneration of brain, not elsewhere classified
清单1中列出了一个满足上述要求的不可变类。
An immutable class that meets the previous requirements appears in Listing 1.
(不可变类的一个优点就是它们是线程安全的)。
One advantage of immutable classes is that they are thread-safe.
因此,您永远都不该为一个不可变类提供一个无参数的构造函数。
Thus, you should never have a no-argument constructor for an immutable class.
应用推荐