mis*_*tor 11
使用WrappedArray从collection.mutable.它为具有最小开销的数组提供了适当的相等性.apply,update等的呼叫委托给底层数组.还有基本类型的特殊类(例如WrappedArray.ofInt),以避免装箱和拆箱.
scala> new WrappedArray.ofInt(Array(2, 3, 4))
res35: scala.collection.mutable.WrappedArray.ofInt = WrappedArray(2, 3, 4)
scala> new WrappedArray.ofInt(Array(2, 3, 4))
res36: scala.collection.mutable.WrappedArray.ofInt = WrappedArray(2, 3, 4)
scala> res35 == res36
res37: Boolean = true
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
545 次 |
| 最近记录: |