Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8709695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:25:42+00:00 2026-06-13T04:25:42+00:00

I have defined a function named ti but after compilation it shows a deprecation

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T04:25:45+00:00Added an answer on June 13, 2026 at 4:25 am

    If it tells you to re-run with -deprecation, you should do that:

    k@k:~$ scala -deprecation
    Welcome to Scala version 2.9.1 (OpenJDK 64-Bit Server VM, Java 1.6.0_24).
    Type in expressions to have them evaluated.
    Type :help for more information.
    
    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
         |         }
    

    Then you get your warnings:

    <console>:7: warning: type Integer is deprecated: use java.lang.Integer instead
           def ti(chars:List[Char],a:List[(Char,Integer)]):List[(Char,Integer)]=
                                     ^
    <console>:7: warning: type Integer is deprecated: use java.lang.Integer instead
           def ti(chars:List[Char],a:List[(Char,Integer)]):List[(Char,Integer)]=
                                                           ^
    <console>:16: warning: type Integer is deprecated: use java.lang.Integer instead
                      a::List((c,j))
                       ^
    

    Here the issue is that you should use java.lang.Integer or just Int if you don’t need interoperability with Java. So you either import java.lang.Integer or change Integer to Int.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to extract defined variable and function names from a js code passed
I have the following object defined function BusinessUnit(id, name, code) { this.id = ko.observable(id);
I have defined a function in vim to properly indent folds. Ie so they
I have defined a function in which i want to open a page on
I have defined a function in my Navigation model that executes a query, and
Friends, I have two files, a.c and b.c . I have defined a function
I have this self-defined function in my .bashrc : function ord() { printf '%d'
I have this user defined function. public partial class UserDefinedFunctions { static int i;
I have a User Defined Function (UDF) written in Java to parse lines in
in header file I have defined the following function #ifndef OS_H #define OS_H #include

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.