immutable object meaning in English
不可变对象
Examples
- One of the most surprising failings of the jmm is that immutable objects , whose immutability was intended to be guaranteed through use of the
Jmm的其中一个最惊人的缺点是,不可变对象似乎可以改变它们的值(这种对象的不变性旨在通过使用 - It is possible for an immutable object be accessed before it s fully created , and this access might yield an incorrect value for some field
对于一个不变对象,在其被未完全创建之前,可以对它进行访问。这种访问对于某些域可以产生不正确的值。 - Should we represent objects that are containers for multiple primitive values , such as points , vectors , matrices , or rgb colors , with mutable or immutable objects
如果要表示的对象是多个基本值的容器(如:点、向量、矩阵或rgb颜色) ,是用可变对象还是用不变对象表示? - Because an immutable object s externally visible state never changes , as long as it is constructed correctly , it can never be observed to be in an inconsistent state
因为一个不可变的对象只要构建正确,其外部可见状态永远也不会改变,永远也不会看到它处于不一致的状态。 - Immutable classes are very useful for simplifying the design of object - oriented programs - immutable objects require less defensive coding and offer relaxed synchronization requirements
不变类对于简化面向对象程序的设计非常有用不变的对象只需要较少的防御性编码,并且不要求严格的同步。