2 wingoo220 wingoo220 于 2017.01.03 17:07 提问

scala reduceLeft 菜鸟求知

val at = Array((1, 1.29), (1, 1.62), (1, 1.73), (3, 3.35), (3, 3.27), (5, 5.81))

at.groupBy(_._1).foreach(i => {
print("key : " + i._1 + " value-sum : " + (i._2.reduceLeftDouble => x + item._2.toDouble)))
println
})

报错:
Error:(116, 68) type arguments [Double] do not conform to method reduceRight's type parameter bounds [B >: (Int, Double)]
print("key : " + i._1 + " value-sum : " + (i._2.reduceRightDouble => x + item._2.toDouble)))
^

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!