[英]Unspecified value parameters: for array in Scala
def rearrange(str: String) = {
var indexes = Array[Int]()
indexes = allIndexes(0, str, indexes)
indexes foreach( println(_) )
}
def allIndexes(position: Int, str: String, tokens: Array[String], indexes: Array[Int]): Array[Int] ={
tokens foreach( (e) => {
var pos = str.indexOf(e, position)
if (pos != -1){
return allIndexes(pos, str, (indexes:+ pos))
}else{
return indexes
}
})
}
The method allIndexes
requires 4 parameters, but you call the method only with 3 arguments. allIndexes
方法需要4个参数,但是仅使用3个参数调用该方法。 Thus, the compiler is complaining that the parameter indexes
is unspecified. 因此,编译器抱怨参数
indexes
未指定。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.