I have two vals:
// 0~250::250~500::500~750::750~1000
val step_x_ranges = stepsAsString.mkString("::")
// 1::22::7::16
val step_y = histogram_final.map{case (x , y) => y}.mkString("::")
And I want to save it to an Array like:
0~250::1
250~500::22
500~750::7
750::1000::16
But still not try out: Please help me
Here is my wrong code:
var toArray : Array[String] = Array()
for (i <- 0 to 3)
{
val ArrayRow = step_x_ranges(i) + "::" + step_y(i)
toArray = toArray :+ ArrayRow
}
println(toArray(0))
println(toArray(1))
Result:
0::4
~::8
Seqs? safaribooksonline.com/library/view/scala-cookbook/9781449340292/… :stepsAsString.zip(histogramFinal).map(...