13
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

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))
*/
13
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
13
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?