Locating Scala Array deep documentation?

橙三吉。 提交于 2019-12-24 03:39:28

问题


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?


回答1:


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]


来源:https://stackoverflow.com/questions/56918171/locating-scala-array-deep-documentation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!