var 元组名= (元素值1,元素值2,元素值...)
var/val t1:Tuple[String,Int,Double]= new Tuple3("abc",12,44.3) var/val t1= ("abc",12,44.3)
var t1=(1,2,3) for(i<- t1.productItertor){ println(i) }
var arr=(1,2,3,4) for(i<- 3){ println(arr.productElement(i))
var arr=(1,2,3,4) for(i<- 0 until arr.productArity){ println(arr.productElement(i)) }
var arr=(1,2,3,4) println(arr.productPrefix)
var arr=(1,2,3,4) var str=arr.toString() println(str) 输出:(1,2,3,4)
var arr=(12,"hello",27.5,true) for(i<- 0 until arr.productArity){ println(arr.productElement(i).toString()) }
输出:
12
hello
27.5
true
arr.swap