copyToArray

trait Collection[A] {
  def copyToArray[B :> A](array: Array[B]): Int
  def copyToArray[B :> A](array: Array[B], i: Int): Int
  def copyToArray[B :> A](array: Array[B], i: Int, l: Int): Int
}

copyToArray copies elements from this collection to an Array and returns how many elements were copied.

The copy can be placed in the target Array at a given offset i.

Also the copy can be restricted to, as much, the first l elements.

In any case, those elements exceeding the bounds of the Array will be discarded.