summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/Iterator.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/scala/collection/Iterator.scala')
-rw-r--r--src/library/scala/collection/Iterator.scala7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala
index 7bd33cbb23..39c1d5b07f 100644
--- a/src/library/scala/collection/Iterator.scala
+++ b/src/library/scala/collection/Iterator.scala
@@ -975,8 +975,8 @@ trait Iterator[+A] extends TraversableOnce[A] {
}
/** Copies selected values produced by this iterator to an array.
- * Fills the given array `xs` with at most `len` values produced by this
- * iterator, after skipping `start` values.
+ * Fills the given array `xs` starting at index `start` with at most
+ * `len` values produced by this iterator.
* Copying will stop once either the end of the current iterator is reached,
* or the end of the array is reached, or `len` elements have been copied.
*
@@ -987,12 +987,11 @@ trait Iterator[+A] extends TraversableOnce[A] {
* @param len the maximal number of elements to copy.
* @tparam B the type of the elements of the array.
*
- *
* @usecase def copyToArray(xs: Array[A], start: Int, len: Int): Unit
*/
def copyToArray[B >: A](xs: Array[B], start: Int, len: Int): Unit = {
var i = start
- val end = start + len min xs.length
+ val end = start + math.min(len, xs.length)
while (hasNext && i < end) {
xs(i) = next()
i += 1