Wrap an existing Array into an ArraySeq of the proper primitive specialization type
without copying.
Wrap an existing Array into an ArraySeq of the proper primitive specialization type
without copying.
Note that an array containing boxed primitives can be wrapped in an ArraySeq without
copying. For example, val a: Array[Any] = Array(1) is an array of Object at runtime,
containing Integers. An ArraySeq[Int] can be obtained with a cast:
ArraySeq.unsafeWrapArray(a).asInstanceOf[ArraySeq[Int]]. The values are still
boxed, the resulting instance is an ArraySeq.ofRef. Writing
ArraySeq.unsafeWrapArray(a.asInstanceOf[Array[Int]]) does not work, it throws a
ClassCastException at runtime.
A companion object used to create instances of
ArraySeq.