我是Scala的新手,有点困惑.
I am new to Scala and am a bit confused.
给出一个列表列表List[List[Int]],如何调用每个列表元素的特定索引,例如每个列表的第二个元素?
Given a list of lists List[List[Int]], how can one call a specific index of an element of each list, for example the second element of each list?
推荐答案简单:
val ints = List( List(1,2), List(3,4) ) val result = ints.map( l => l(1) )这将产生(2,4).