我定义了一个名为ti
但编译后它显示弃用警告的函数。我在 Eclipse 中做了同样的事情。该代码工作正常,但显示警告。
scala> def ti(chars:List[Char],a:List[(Char,Integer)]):List[(Char,Integer)] = {
| if(chars.length!=0) {
| var j = 1
| var c = chars.head
| for(i<-chars.tail) {
| if(c==i) j=j+1
| }
| a::List((c,j))
| ti(chars.tail,a)
| }
| else a
| }
警告:有 3 个弃用警告;使用 -deprecation 重新运行以获取详细信息 ti: (chars: List[Char], a: List[(Char, Integer)])List[(Char, Integer)]
这是什么原因?