较长的集合的最后一个元素在拉链时会被舍弃
val ints = List(1,2,3,4)
val ints1 = List(4,5,6,7,8)
// 拉链:zip
val tuples: List[(Int, Int)] = ints.zip(ints1)
tuples.foreach(println)
(1,4)
(2,5)
(3,6)
(4,7)
较长的集合的最后一个元素在拉链时会被舍弃
val ints = List(1,2,3,4)
val ints1 = List(4,5,6,7,8)
// 拉链:zip
val tuples: List[(Int, Int)] = ints.zip(ints1)
tuples.foreach(println)
(1,4)
(2,5)
(3,6)
(4,7)