我想知道,为什么由于错误而这不起作用
object ws1 {
class MyClass(a: Long)
val biList = List(BigInt(1), BigInt(2))
val mcList = biList map { new MyClass(_.longValue) } // error
//val mcList = biList map { x => new MyClass(x.longValue) } // ok
}
的
missing parameter type for expanded function ((x$1) => x$1.longValue)
或更准确地说
type mismatch: found ws1.MyClass, required scala.math.BigInt => ?
missing parameter type for expanded function ((x$1) => x$1.longValue)