How I can use another way to copy a Array to another Array?
My thought is to use the = operator. For example:
Consider Array.copy in this example where dest is a mutable Array,
val a = (1 to 5).toArray
val dest = new Array[Int](a.size)
and so
dest
Array[Int] = Array(0, 0, 0, 0, 0)
Then for
Array.copy(a, 0, dest, 0, a.size)
we have that
dest
Array[Int] = Array(1, 2, 3, 4, 5)
From Scala Array API note Scala Array.copy is equivalent to Java System.arraycopy, with support for polymorphic arrays.