dsg*_*dsg 50 scala map variadic-functions
Map在scala中创建时,我打电话给我Map(entities.map{e => e.id -> e}),然后我得到:
found : scala.collection.mutable.IndexedSeq[(Int, Entity)]
required: (Int, Entity)
Run Code Online (Sandbox Code Playgroud)
这是因为签名Map.apply是:def apply[A, B](elems: (A, B)*): CC[A, B],这需要一个varargs样式参数.
有没有办法转换,IndexedSeq以便可以通过Map.apply?