按說我有元組的列表:整數元組字符串元組
tuple1: List[(Int, Int)] = List((0,3), (3,6), (6,12), (12,14), (14,15))
我怎樣才能將其更改爲:
tuple1: List[(String, String)] = List((0,3), (3,6), (6,12), (12,14), (14,15))
我嘗試了以下:
tuple1.unzip match { case(l1, l2) => (l1.toString, l2.toString)}
res9: (String, String) = (List(0, 3, 6, 12, 14),List(3, 6, 12, 14, 15))
tuple1 map(_.toString)
res5: List[String] = List((0,3), (3,6), (6,12), (12,14), (14,15))
兩個不是我正在尋找的結果。