I have two lists, List(1,2),List(3,4)
and I want Two-dimensional List(List(1,2),List(3,4))
like this,how?
I have two lists, List(1,2),List(3,4)
and I want Two-dimensional List(List(1,2),List(3,4))
like this,how?
Is this what you mean?
val a = List(1,2)
val b = List(3,4)
val c = List(a,b) // List(List(1,2),List(3,4))
if you really want a List of Lists then @Dionysis answer is ok. You can use
val a = List(1,2)
val b = List(3,4)
a.zip(b) //res0: List[(Int, Int)] = List((1,3), (2,4))
if you don´t need that type