Array:数组
val arr = Array(1,2,3,4,5)
val arr = new Array[int](10)
arr.mkString(" and ") //(1 and 2 and 3 ...)
arr.mkString("<", ",", ">") //(<1,2,3,4,5>)
矩阵/二维数组:
val matrix = Array.ofDim[Double](3,4) //三行四列
matrix(2)(3) = 42
ArrayBuffer:可变数组,需要 import scala.collection.mutable.ArrayBuffer
val arrBuffer = ArrayBuffer[int]()
arrBuffer += 1
arrBuffer += (1,2,3)
arrBuffer ++= Array(3,4,5)
arrBuffer.trimEnd(5)
arrBuffer.insert(2,6,7,8,9)
arrBuffer.remove(2,3) //从下标为2开始删除3个