Skip to content

Commit 2686334

Browse files
authored
Merge pull request scala#6467 from hvesalai/tmp/copyToArrayScaladoc
Better wording for 'copyToArray' scaladoc
2 parents 312ddb5 + f4ccca6 commit 2686334

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/library/scala/collection/IterableOnce.scala

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -620,18 +620,20 @@ trait IterableOnceOps[+A, +CC[_], +C] extends Any { this: IterableOnce[A] =>
620620
@deprecated("Use `dest ++= coll` instead", "2.13.0")
621621
@inline final def copyToBuffer[B >: A](dest: mutable.Buffer[B]): Unit = dest ++= this
622622

623-
/** Copy elements of this collection to an array.
624-
* Fills the given array `xs` starting at index `start`.
625-
* Copying will stop once either the all elements of this collection have been copied,
623+
/** Copy elements to an array.
624+
*
625+
* Fills the given array `xs` starting at index `start` with values of this $coll.
626+
*
627+
* Copying will stop once either all the elements of this $coll have been copied,
626628
* or the end of the array is reached.
627629
*
628630
* @param xs the array to fill.
629-
* @param start the starting index.
631+
* @param start the starting index of xs.
630632
* @tparam B the type of the elements of the array.
631633
*
632634
* @usecase def copyToArray(xs: Array[A], start: Int): Unit
633635
*
634-
* $willNotTerminateInf
636+
* $willNotTerminateInf
635637
*/
636638
def copyToArray[B >: A](xs: Array[B], start: Int = 0): xs.type = {
637639
val it = iterator()
@@ -643,14 +645,15 @@ trait IterableOnceOps[+A, +CC[_], +C] extends Any { this: IterableOnce[A] =>
643645
xs
644646
}
645647

646-
/** Copy elements of this collection to an array.
647-
* Fills the given array `xs` starting at index `start` with at most
648-
* `len` values produced by this iterator.
649-
* Copying will stop once either the all elements of this collection have been copied,
648+
/** Copy elements to an array.
649+
*
650+
* Fills the given array `xs` starting at index `start` with at most `len` elements of this $coll.
651+
*
652+
* Copying will stop once either all the elements of this $coll have been copied,
650653
* or the end of the array is reached, or `len` elements have been copied.
651654
*
652655
* @param xs the array to fill.
653-
* @param start the starting index.
656+
* @param start the starting index of xs.
654657
* @param len the maximal number of elements to copy.
655658
* @tparam B the type of the elements of the array.
656659
*
@@ -723,7 +726,7 @@ trait IterableOnceOps[+A, +CC[_], +C] extends Any { this: IterableOnce[A] =>
723726
throw new UnsupportedOperationException("empty.min")
724727
reduceLeft((x, y) => if (ord.lteq(x, y)) x else y)
725728
}
726-
729+
727730
/** Finds the smallest element.
728731
*
729732
* @param ord An ordering to be used for comparing elements.
@@ -760,7 +763,7 @@ trait IterableOnceOps[+A, +CC[_], +C] extends Any { this: IterableOnce[A] =>
760763
throw new UnsupportedOperationException("empty.max")
761764
reduceLeft((x, y) => if (ord.gteq(x, y)) x else y)
762765
}
763-
766+
764767
/** Finds the largest element.
765768
*
766769
* @param ord An ordering to be used for comparing elements.

0 commit comments

Comments
 (0)