【发布时间】:2013-12-15 04:28:03
【问题描述】:
对于以下方法,检查传入数组是否为 None 的方法是什么(又名 null fro java land..)
val x = Array(22.0,122,222,322,422,522,622,722,822,922)
def stddev(arr :Array[Double]) = {
arr match {
case None => 0
..
错误是:
<console>:11: error: pattern type is incompatible with expected type;
found : None.type
required: Array[Double]
Note: if you intended to match against the class, try `case _: <none>`
case None => 0
^
【问题讨论】: