Help us understand the problem. What is going on with this article?

Scalaで多次元配列

More than 5 years have passed since last update.

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))
*/
takilog
機械学習・数理最適化を用いた研究業務に従事しています (see @cocomoff)
http://takiblog.hateblo.jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away