Part of the power of Scala is that it encourages developers to create immutable objects by default.
Scala的一个强大之处就在于,它鼓励开发人员以默认方式创建不可改变的对象。
Anders Janmyr has a good overview of the new features including the ability to support non-extensible and immutable objects.
Anders Janmyr出色地概述了新功能,包括支持非扩展性和不可变对象的能力。
There can be no side effects on immutable objects, and caching a reference to an immutable object is always safe from alias problems.
不可变对象上没有副作用,并且缓存不可变对象的引用总是安全的,不会出现别名问题。
Many people are betting on functional programming, with its emphasis on immutable objects and their inherently thread-safe properties.
很多人现在都投身于函数式编程的世界,由于它们具有不可变的对象,以及与生俱来的线程安全属性。
Placing immutable objects in a scoped container avoids most atomicity and visibility failures; it is also safe to place effectively immutable objects in a scoped container.
将不可修改对象放置在范围容器避免了许多原子性和可见性故障;将有效不可修改性对象放置在范围容器中也是安全的。
If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super. clone need to be modified.
如果一个类只包含基本字段或对不变对象的引用,那么通常不需要修改super .clone返回的对象中的字段。
So as long as you stick to the simplest rules of concurrent programming - stateless services and immutable objects, it will be a breeze to wire your services to any producer or consumer.
所以只要你坚持并发编程的最简单规则——无状态服务和不变对象,将你的服务绑定到任何生产者或消费者上都会轻而易举。
Public Service Reminder: Making all fields of an object final does not necessarily make the object immutable -- all fields must also be primitive types or references to immutable objects.
PublicServiceReminder:让一个对象的所有字段都为final并不一定使得这个对象不可变 —— 所有的字段还必须是原语类型或是对不可变对象的引用。
Further, for data members that are object references, the referred-to objects must be effectively immutable.
此外,对于对象引用的数据成员,引用的对象必须是有效不可变的。
The returned event objects are immutable and the application can cache them beyond the parsing process.
返回的事件对象是不变的,应用程序可以保存到解析过程之后。
Because BigDecimal objects are immutable, each of these methods produces a new BigDecimal object.
由于BigDecimal对象是不可变的,这些方法中的每一个都会产生新的BigDecimal对象。
As immutable sequences, both tuple and string objects can't be modified once they're created.
作为不可变的序列,tuple和string对象在创建之后便无法修改。
Duration objects are immutable and you can create them from a wide range of values, including.
Duration对象是不变的,可以从各种不同的值创建,其中包括。
In case you were looking at the objects folder: Files in the objects folder are immutable and won't get modified. They will only be deleted and added.
如果你想在对象的文件夹:在目标文件夹中的文件是不可变的,不会被修改。他们只会被删除和添加。
In case you were looking at the objects folder: Files in the objects folder are immutable and won't get modified.
如果你想在对象的文件夹:在目标文件夹中的文件是不可变的,不会被修改。
Use this method for objects that are immutable, but for which you want to provide changeable properties.
对不可变但希望为其提供可变属性的对象使用此方法。
If the internal state cannot change, there is no chance for different threads to see inconsistent views of the data. Immutable types can be exported from your objects safely.
如果内部状态不能被改变,那么对于不同的线程来说,就没有机会看到这个数据的不同值。
If the internal state cannot change, there is no chance for different threads to see inconsistent views of the data. Immutable types can be exported from your objects safely.
如果内部状态不能被改变,那么对于不同的线程来说,就没有机会看到这个数据的不同值。
应用推荐