0

When I tried to run the LP algorithm in GraphX,I ran into a problem, and I wondered what this collection.breakOut was doing here,can anyone help me?

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)
    val count2Val = count2.getOrElse(i, 0L)
    i -> (count1Val + count2Val)
  }(collection.breakOut)}

the collection.breakOut code is this:

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

}

0 Answers0