2
我已經定義了一個名爲ti
的函數,但是編譯後會顯示棄用警告。我在Eclipse中做了同樣的事情。代碼工作正常,但它顯示一個警告。scala中的棄用警告
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的細節重新運行 鈦(字符:列表[字符]答:列表[(字符,整數)])列表[(字符,整數)
,這是什麼原因?