定义为的偏函数的性能是否有任何差异
val matches = {
case Match(x,y) => ...
case AnotherMatch(x,y,z) => ...
case x:YetAnother => ...
}
一个定义如下?
val match1 = {
case Match(x,y) => ...
}
val match2 = {
case AnotherMatch(x,y,z) => ...
}
val match3 = {
case x:YetAnother => ...
}
val matches = match1 orElse match2 orElse match3