Reputation: 5604
Is it possible to create a multidimensional array in scala without using the "Array()"
Like this in java:
int[][] myIntArray = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} };
Upvotes: 1
Views: 237
Reputation: 5436
If i understood correctly, you dont want to declare the array repeating Array a lot of times.
Array
You can try this:
val > = Array val x: Array[Array[Int]] = >( >(1, 2, 3), >(4, 5, 6), >(7, 8, 9) )
Source (There are other suggestions also)
Upvotes: 8