查找Scala Array的深入文档? [英] Locating Scala Array deep documentation?

查看:60
本文介绍了查找Scala Array的深入文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是不正确的顺序吗?

解决方案

似乎它已经根据 https://github.com/从Scala 2.13中删除。 scala / bug / issues / 10985


这是一个骇人的丑陋测试实用程序,用于在(嵌套)数组中打印值。
如果您对此有强烈的兴趣,可以将其弃用。


您仍然可以在 2.12文档 2.12分支

  / **创建可能的嵌套IndexedSeq,它由该数组的所有元素
*组成。如果元素本身是数组,则将'deep'转换
*递归应用于它们。 IndexedSeq的stringPrefix是
* Array,因此,IndexedSeq的打印就像一个数组,其中显示了所有
*的元素,并且递归地用于任何子数组。
*
*示例:
* {{{
* Array(Array(1,2),Array(3,4))。deep.toString
* }}}
*打印:ʻArray(Array(1(2,2),Array(3,4))`
*
* @return可能是嵌套索引的序列,由所有数组的元素。
* /
的定义深度:scala.collection.IndexedSeq [Any]


SO answer by Jerry includes this use of deep:

println(k.deep)

Works as described:

scala> println(Array(10, 20, 30, 40).deep)
Array(10, 20, 30, 40)

I am looking for documentation on deep for an Array. I go to Scala Standard Library 2.13.0 Array and do a search of the page for deepand get no matches.

How is this the incorrect sequence?

解决方案

It seems it has been removed from Scala 2.13 according to https://github.com/scala/bug/issues/10985:

It's a hacky ugly testing utility to print values in (nested) arrays. If you feel strongly about it, we can add it deprecated.

You can still find it in 2.12 docs and in 2.12 branch:

  /** 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]

这篇关于查找Scala Array的深入文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆