LoginSignup
12
9

More than 5 years have passed since last update.

Scalaで多次元配列

Posted at

ListBufferを複数段重ねてもいいのですが,やはり多次元配列が楽でしょう.簡単にある型を持った多次元配列を作るにはofDimを使うと楽だと分かりました.ちなみにArrayは普通に出力(println)すると中身は見えませんので,.deepを使うと中身も見れてListBufferのように使えます.

Marray.scala
val array = Array.ofDim[Int](2, 3)
println(array.deep)

/* Output
Array(Array(0, 0, 0), Array(0, 0, 0))
*/
12
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
9