"collection.breakOut" 在函数 scala mergeMes​​sage 中可以做什么?

问题描述

当我试图在 GraphX 中运行 LP 算法时,我遇到了一个问题,我想知道这个 collection.breakOut 在这里做什么,有人可以帮我吗?

def mergeMessage(count1: Map[VertexId,Long],count2: Map[VertexId,Long])
  : Map[VertexId,Long] = {
  val temp_d1 = count1.keySet++count2.keySet
  val temp_d2 = temp_d1.map(i=>{
    val count1Val = count1.getorElse(i,0L)
    val count2Val = count2.getorElse(i,0L)
    i -> (count1Val+count2Val)
  })

   //val temp_d3 = temp_d2(collection.breakOut)  //this can raise a error

  (count1.keySet ++ count2.keySet).map { i =>
    val count1Val = count1.getorElse(i,0L)
    i -> (count1Val + count2Val)
  }(collection.breakOut)}

collection.breakOut 代码是这样的:

package object collection extends scala.AnyRef {
    def breakOut[From,T,To](implicit b : scala.collection.generic.CanBuildFrom[scala.nothing,To]) : scala.collection.generic.CanBuildFrom[From,To] = { /* compiled code */ }

}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)