Scala: how to check whether a object is instance of Array
stackoverflow.com › questions › 44454287Jun 9, 2017 · If you don't care the type of Array, you can compare to Array[_] (array of whatever type) scala> var x = Array(1,2,3) x: Array[Int] = Array(1, 2, 3) scala> x.isInstanceOf[Array[Int]] res0: Boolean = true scala> x.isInstanceOf[Array[_ <: Any]] res7: Boolean = true scala> x.isInstanceOf[Array[_ <: AnyVal]] res12: Boolean = true scala> x.isInstanceOf[Array[_]] res13: Boolean = true
Scala | Arrays - GeeksforGeeks
www.geeksforgeeks.org › scala-arraysMar 11, 2019 · Array is a special kind of collection in scala. it is a fixed size data structure that stores elements of the same data type. The index of the first element of an array is zero and the last element is the total number of elements minus one. It is a collection of mutable values. It corresponds to arrays (in terms of syntax) in java but at the same time it’s different (in terms of functionalities) from java.