将元组的ListBuffer转换为元组映射

时间:2019-06-30 10:44:50

标签: scala

我正在尝试将元组[[value1,value2)]的ListBuffer转换为Map [value1->(value1,value2)]

var ListBuffer = ListBuffer[(Int, Boolean)]()
.... (filling the listBuffer from file)
var portsMap = Map[Int,(Int,Boolean)]

//that was i thought right to do in order to achieve the Map
 portsMap = portListBuffer.toMap{(port, bool) => [port, (port,bool)]}

0 个答案:

没有答案