We could have used a val with a mutable type, like ListBuffer.
我们也可以使用val和一个可变的类型,比如ListBuffer。
Unlike strings, which are immutable, lists are a mutable type, i. e. it is possible to change their content.
不像字符串是不可变量,列表是可变类型,例如:它可以改变它本身某个元素的值。
Clearly, this approach is a pain but the solution is easy: Never use a mutable object type as a key in a HashMap.
很显然,这种方法很糟糕,但是解决方法也很简单:永远不要将可变对象类型用作hashmap中的键。
Unearthing tidbits often involves some complexity, however, like discovering that you can have your way with HashMap, just as long as you never use a mutable object type as its key.
但是发掘这些有用之物可能有点复杂,比如只要您不将可变对象类型作为键,您就可以用自己的方式使用 HashMap。
The dictionary container in Python is also a mutable data type, which means you can change it after it has been created.
Python中的dictionary容器也是易变的数据类型,这意味着在创建它之后可以修改它。
This article introduces a new sequence type: the list, which is a mutable sequence type that demonstrates a number of different ways it can be used.
本文介绍一个新的序列类型:list,这是一个可变的序列类型,并演示以多种不同方法使用它。
This article introduces a new sequence type: the list, which is a mutable sequence type that demonstrates a number of different ways it can be used.
本文介绍一个新的序列类型:list,这是一个可变的序列类型,并演示以多种不同方法使用它。
应用推荐