Define Array In Scala
Define Array In Scala . The scala package contains core types like int, float, array or option which are accessible in all scala compilation units without explicit qualification or imports. If you already have the elements, you can create an array like this: Arrays and Lists (in Scala) YouTube from www.youtube.com In this example, we will show simple program about, how to use arraylist in scala.the example program has been tested and shared in the same post. Val myarray = array.ofdim [int] (n,n) //use vals if you can, arrays are mutable val myseq = myarray.map (_.toseq).toseq //convert all inner arrays to seq and then the outer array to seq foo (myseq) keep in mind that array is mutable, while seq is not. Scala> val a = array (1,2,3) a: