CW *_* II 4 documentation scala
Jerry 的 SO 回答包括以下用法deep:
println(k.deep)
Run Code Online (Sandbox Code Playgroud)
工作原理:
scala> println(Array(10, 20, 30, 40).deep)
Array(10, 20, 30, 40)
Run Code Online (Sandbox Code Playgroud)
我找对文档deep进行的Array。我转到Scala Standard Library 2.13.0 Array并搜索页面deep并没有找到匹配项。
这个顺序不正确怎么办?
根据https://github.com/scala/bug/issues/10985,它似乎已从 Scala 2.13 中删除:
在(嵌套)数组中打印值是一个非常丑陋的测试实用程序。如果您对此感觉强烈,我们可以将其添加为弃用。
/** Creates a possible nested `IndexedSeq` which consists of all the elements
* of this array. If the elements are arrays themselves, the `deep` transformation
* is applied recursively to them. The `stringPrefix` of the `IndexedSeq` is
* "Array", hence the `IndexedSeq` prints like an array with all its
* elements shown, and the same recursively for any subarrays.
*
* Example:
* {{{
* Array(Array(1, 2), Array(3, 4)).deep.toString
* }}}
* prints: `Array(Array(1, 2), Array(3, 4))`
*
* @return An possibly nested indexed sequence of consisting of all the elements of the array.
*/
def deep: scala.collection.IndexedSeq[Any]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
366 次 |
| 最近记录: |