One advantage of immutable classes is that they are thread-safe.
(不可变类的一个优点就是它们是线程安全的)。
Finally, one of the best features of immutable classes is how well they fit into the composition abstraction.
最后要说一点,不可变类最酷的一个地方是,它们融合到复合(composition) 抽象中的能力是如此之强。
Making the message classes immutable and cloning mutable references such as arrays at construction time would have prevented this problem.
使得消息类不可变并在构造时克隆像数组这样的可变引用,就可以防止该问题。
Some repositories have immutable item classes that are set based on the item type, while others will allow a repository administrator or end user to define the classes that can be set on an item.
某些存储库具有不可改变的项目类,对其的设定是基于项目类型的;而其他的存储库则允许存储库管理员或终端用户对类进行定义,对其的设定是基于项目的。
The Joda classes I discuss in this article are immutable, so instances of them cannot be modified.
我在本文讨论的Joda类具有不可变性,因此它们的实例无法被修改。
Joda classes that represent immutable instants in time are subclasses of this one.
表示时间上的不可变瞬间的joda类都属于这个类的子类。
When creating anonymous classes, programmers can use the modifier "Key" to indicate which fields are immutable.
当创建匿名类型时,程序员可以用关键词“Key”表示哪些字段是稳定的。
When creating anonymous classes, programmers can use the modifier "Key" to indicate which fields are immutable.
当创建匿名类型时,程序员可以用关键词“Key”表示哪些字段是稳定的。
应用推荐