I have defined a function named ti but after compilation it shows a deprecation warning. I did the same in Eclipse. The code works fine but it shows a warning.
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
| }
warning: there were 3 deprecation warnings; re-run with -deprecation for details
ti: (chars: List[Char], a: List[(Char, Integer)])List[(Char, Integer)]
What is the reason for this?
If it tells you to re-run with -deprecation, you should do that:
Then you get your warnings:
Here the issue is that you should use
java.lang.Integeror justIntif you don’t need interoperability with Java. So you eitherimport java.lang.Integeror changeIntegertoInt.