How to add data to a TrieMap[Long,List[Long]] in Scala

后端 未结 1 1474
深忆病人
深忆病人 2021-01-29 08:33

i have this:

val vertexIdListPartitions: TrieMap[Long, List[Long]] = TrieMap()

i need to add List(3) at vertexIdListPartitio

相关标签:
1条回答
  • 2021-01-29 09:15

    Mutable collections have the update() method for this.

    vertexIdListPartitions.update(3L, List(3))  //res0: Unit = ()
    vertexIdListPartitions  //res1: TrieMap[Long,List[Long]] = TrieMap(3 -> List(3))
    
    0 讨论(0)
提交回复
热议问题