@@ -65,6 +65,7 @@ object Array {
6565 *
6666 * @tparam A the element type of the array, must have a `ClassTag`
6767 * @param dummy the `Array` companion object, used to trigger the implicit conversion
68+ * @return a `Factory` that builds an `Array[A]` from an `IterableOnce[A]`
6869 */
6970 implicit def toFactory [A : ClassTag ](dummy : Array .type ): Factory [A , Array [A ]] = new ArrayFactory (dummy)
7071 @ SerialVersionUID (3L )
@@ -77,6 +78,7 @@ object Array {
7778 *
7879 * @tparam T the element type of the array to build
7980 * @param t the `ClassTag` for the element type, used to create the correct array type at runtime
81+ * @return a new `ArrayBuilder[T]` for incrementally constructing an `Array[T]`
8082 */
8183 def newBuilder [T ](implicit t : ClassTag [T ]): ArrayBuilder [T ] = ArrayBuilder .make[T ](using t)
8284
@@ -212,6 +214,7 @@ object Array {
212214 /** Returns an array of length 0.
213215 *
214216 * @tparam T the element type of the empty array
217+ * @return an empty `Array[T]` of length `0`
215218 */
216219 def empty [T : ClassTag ]: Array [T ] = new Array [T ](0 )
217220
@@ -236,6 +239,7 @@ object Array {
236239 *
237240 * @param x the first element
238241 * @param xs the remaining elements
242+ * @return an `Array[Boolean]` containing `x` followed by all elements of `xs`
239243 */
240244 // Subject to a compiler optimization in Cleanup, see above.
241245 def apply (x : Boolean , xs : Boolean * ): Array [Boolean ] = {
@@ -253,6 +257,7 @@ object Array {
253257 *
254258 * @param x the first element
255259 * @param xs the remaining elements
260+ * @return an `Array[Byte]` containing `x` followed by all elements of `xs`
256261 */
257262 // Subject to a compiler optimization in Cleanup, see above.
258263 def apply (x : Byte , xs : Byte * ): Array [Byte ] = {
@@ -270,6 +275,7 @@ object Array {
270275 *
271276 * @param x the first element
272277 * @param xs the remaining elements
278+ * @return an `Array[Short]` containing `x` followed by all elements of `xs`
273279 */
274280 // Subject to a compiler optimization in Cleanup, see above.
275281 def apply (x : Short , xs : Short * ): Array [Short ] = {
@@ -287,6 +293,7 @@ object Array {
287293 *
288294 * @param x the first element
289295 * @param xs the remaining elements
296+ * @return an `Array[Char]` containing `x` followed by all elements of `xs`
290297 */
291298 // Subject to a compiler optimization in Cleanup, see above.
292299 def apply (x : Char , xs : Char * ): Array [Char ] = {
@@ -304,6 +311,7 @@ object Array {
304311 *
305312 * @param x the first element
306313 * @param xs the remaining elements
314+ * @return an `Array[Int]` containing `x` followed by all elements of `xs`
307315 */
308316 // Subject to a compiler optimization in Cleanup, see above.
309317 def apply (x : Int , xs : Int * ): Array [Int ] = {
@@ -321,6 +329,7 @@ object Array {
321329 *
322330 * @param x the first element
323331 * @param xs the remaining elements
332+ * @return an `Array[Long]` containing `x` followed by all elements of `xs`
324333 */
325334 // Subject to a compiler optimization in Cleanup, see above.
326335 def apply (x : Long , xs : Long * ): Array [Long ] = {
@@ -338,6 +347,7 @@ object Array {
338347 *
339348 * @param x the first element
340349 * @param xs the remaining elements
350+ * @return an `Array[Float]` containing `x` followed by all elements of `xs`
341351 */
342352 // Subject to a compiler optimization in Cleanup, see above.
343353 def apply (x : Float , xs : Float * ): Array [Float ] = {
@@ -355,6 +365,7 @@ object Array {
355365 *
356366 * @param x the first element
357367 * @param xs the remaining elements
368+ * @return an `Array[Double]` containing `x` followed by all elements of `xs`
358369 */
359370 // Subject to a compiler optimization in Cleanup, see above.
360371 def apply (x : Double , xs : Double * ): Array [Double ] = {
@@ -372,6 +383,7 @@ object Array {
372383 *
373384 * @param x the first element
374385 * @param xs the remaining elements
386+ * @return an `Array[Unit]` containing `x` followed by all elements of `xs`
375387 */
376388 def apply (x : Unit , xs : Unit * ): Array [Unit ] = {
377389 val array = new Array [Unit ](xs.length + 1 )
@@ -388,6 +400,7 @@ object Array {
388400 *
389401 * @tparam T the element type of the array
390402 * @param n1 the number of elements in the 1st dimension
403+ * @return a new `Array[T]` of length `n1` with all elements initialized to their default value
391404 */
392405 def ofDim [T : ClassTag ](n1 : Int ): Array [T ] =
393406 new Array [T ](n1)
@@ -396,6 +409,7 @@ object Array {
396409 * @tparam T the element type of the array
397410 * @param n1 the number of elements in the 1st dimension
398411 * @param n2 the number of elements in the 2nd dimension
412+ * @return a new `Array[Array[T]]` with dimensions `n1 x n2`, with all elements initialized to their default value
399413 */
400414 def ofDim [T : ClassTag ](n1 : Int , n2 : Int ): Array [Array [T ]] = {
401415 val arr : Array [Array [T ]] = (new Array [Array [T ]](n1): Array [Array [T ]])
@@ -409,6 +423,7 @@ object Array {
409423 * @param n1 the number of elements in the 1st dimension
410424 * @param n2 the number of elements in the 2nd dimension
411425 * @param n3 the number of elements in the 3rd dimension
426+ * @return a new `Array[Array[Array[T]]]` of size `n1 x n2 x n3`, with all elements initialized to their default value
412427 */
413428 def ofDim [T : ClassTag ](n1 : Int , n2 : Int , n3 : Int ): Array [Array [Array [T ]]] =
414429 tabulate(n1)(_ => ofDim[T ](n2, n3))
@@ -419,6 +434,7 @@ object Array {
419434 * @param n2 the number of elements in the 2nd dimension
420435 * @param n3 the number of elements in the 3rd dimension
421436 * @param n4 the number of elements in the 4th dimension
437+ * @return a new `Array[Array[Array[Array[T]]]]` of size `n1 x n2 x n3 x n4`, with all elements initialized to their default value
422438 */
423439 def ofDim [T : ClassTag ](n1 : Int , n2 : Int , n3 : Int , n4 : Int ): Array [Array [Array [Array [T ]]]] =
424440 tabulate(n1)(_ => ofDim[T ](n2, n3, n4))
@@ -430,6 +446,7 @@ object Array {
430446 * @param n3 the number of elements in the 3rd dimension
431447 * @param n4 the number of elements in the 4th dimension
432448 * @param n5 the number of elements in the 5th dimension
449+ * @return a new `Array[Array[Array[Array[Array[T]]]]]` of size `n1 x n2 x n3 x n4 x n5`, with all elements initialized to their default value
433450 */
434451 def ofDim [T : ClassTag ](n1 : Int , n2 : Int , n3 : Int , n4 : Int , n5 : Int ): Array [Array [Array [Array [Array [T ]]]]] =
435452 tabulate(n1)(_ => ofDim[T ](n2, n3, n4, n5))
@@ -483,6 +500,7 @@ object Array {
483500 * @param n1 the number of elements in the 1st dimension
484501 * @param n2 the number of elements in the 2nd dimension
485502 * @param elem the element computation
503+ * @return a 2-dimensional `Array[Array[T]]` of size `n1 x n2`, where each element contains the result of (separately) computing `elem`
486504 */
487505 def fill [T : ClassTag ](n1 : Int , n2 : Int )(elem : => T ): Array [Array [T ]] =
488506 tabulate(n1)(_ => fill(n2)(elem))
@@ -495,6 +513,7 @@ object Array {
495513 * @param n2 the number of elements in the 2nd dimension
496514 * @param n3 the number of elements in the 3rd dimension
497515 * @param elem the element computation
516+ * @return a 3-dimensional array of size `n1 x n2 x n3`, where each element contains the result of (separately) computing `elem`
498517 */
499518 def fill [T : ClassTag ](n1 : Int , n2 : Int , n3 : Int )(elem : => T ): Array [Array [Array [T ]]] =
500519 tabulate(n1)(_ => fill(n2, n3)(elem))
@@ -508,6 +527,7 @@ object Array {
508527 * @param n3 the number of elements in the 3rd dimension
509528 * @param n4 the number of elements in the 4th dimension
510529 * @param elem the element computation
530+ * @return a 4-dimensional array of size `n1 x n2 x n3 x n4`, where each element contains the result of (separately) computing `elem`
511531 */
512532 def fill [T : ClassTag ](n1 : Int , n2 : Int , n3 : Int , n4 : Int )(elem : => T ): Array [Array [Array [Array [T ]]]] =
513533 tabulate(n1)(_ => fill(n2, n3, n4)(elem))
@@ -522,6 +542,7 @@ object Array {
522542 * @param n4 the number of elements in the 4th dimension
523543 * @param n5 the number of elements in the 5th dimension
524544 * @param elem the element computation
545+ * @return a 5-dimensional array of size `n1 x n2 x n3 x n4 x n5`, where each element contains the result of (separately) computing `elem`
525546 */
526547 def fill [T : ClassTag ](n1 : Int , n2 : Int , n3 : Int , n4 : Int , n5 : Int )(elem : => T ): Array [Array [Array [Array [Array [T ]]]]] =
527548 tabulate(n1)(_ => fill(n2, n3, n4, n5)(elem))
@@ -555,6 +576,7 @@ object Array {
555576 * @param n1 the number of elements in the 1st dimension
556577 * @param n2 the number of elements in the 2nd dimension
557578 * @param f The function computing element values
579+ * @return a 2-dimensional `Array[Array[T]]` of size `n1 x n2`, where element `(i1, i2)` is `f(i1, i2)`
558580 */
559581 def tabulate [T : ClassTag ](n1 : Int , n2 : Int )(f : (Int , Int ) => T ): Array [Array [T ]] =
560582 tabulate(n1)(i1 => tabulate(n2)(f(i1, _)))
@@ -567,6 +589,7 @@ object Array {
567589 * @param n2 the number of elements in the 2nd dimension
568590 * @param n3 the number of elements in the 3rd dimension
569591 * @param f The function computing element values
592+ * @return a 3-dimensional array of size `n1 x n2 x n3`, where element `(i1, i2, i3)` is `f(i1, i2, i3)`
570593 */
571594 def tabulate [T : ClassTag ](n1 : Int , n2 : Int , n3 : Int )(f : (Int , Int , Int ) => T ): Array [Array [Array [T ]]] =
572595 tabulate(n1)(i1 => tabulate(n2, n3)(f(i1, _, _)))
@@ -580,6 +603,7 @@ object Array {
580603 * @param n3 the number of elements in the 3rd dimension
581604 * @param n4 the number of elements in the 4th dimension
582605 * @param f The function computing element values
606+ * @return a 4-dimensional array of size `n1 x n2 x n3 x n4`, where element `(i1, i2, i3, i4)` is `f(i1, i2, i3, i4)`
583607 */
584608 def tabulate [T : ClassTag ](n1 : Int , n2 : Int , n3 : Int , n4 : Int )(f : (Int , Int , Int , Int ) => T ): Array [Array [Array [Array [T ]]]] =
585609 tabulate(n1)(i1 => tabulate(n2, n3, n4)(f(i1, _, _, _)))
@@ -594,6 +618,7 @@ object Array {
594618 * @param n4 the number of elements in the 4th dimension
595619 * @param n5 the number of elements in the 5th dimension
596620 * @param f The function computing element values
621+ * @return a 5-dimensional array of size `n1 x n2 x n3 x n4 x n5`, where element `(i1, i2, i3, i4, i5)` is `f(i1, i2, i3, i4, i5)`
597622 */
598623 def tabulate [T : ClassTag ](n1 : Int , n2 : Int , n3 : Int , n4 : Int , n5 : Int )(f : (Int , Int , Int , Int , Int ) => T ): Array [Array [Array [Array [Array [T ]]]]] =
599624 tabulate(n1)(i1 => tabulate(n2, n3, n4, n5)(f(i1, _, _, _, _)))
@@ -760,6 +785,7 @@ object Array {
760785 * @define undefinedorder
761786 *
762787 * @tparam T the type of the elements in the array
788+ * @param _length the length of the array
763789 */
764790final class Array [T ](_length : Int ) extends java.io.Serializable with java.lang.Cloneable { self =>
765791
0 commit comments