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 7606911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:31:42+00:00 2026-05-31T00:31:42+00:00

I have a function whose arguments are: myFn(String, List<Number>, List<Number>) The calling function has

  • 0

I have a function whose arguments are:

 myFn(String, List<Number>, List<Number>)

The calling function has two objects of List which I want to use as the 2nd and third argument of the function. I get the compilation error:

The method myFn(String, List<Number>, List<Number>) in the type MyLib is not applicable for the arguments (String, List<Double>, List<Double>)

Is there an easy way to overcome this? Is there an easy way to cast the list of Double into a List of Number?

  • 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-05-31T00:31:43+00:00Added an answer on May 31, 2026 at 12:31 am

    You cannot cast List<Double> to a List<Number> because the following code would break your List<Double>

    List<Double> list = new List<Double>();
    List<Number> list1 = list; // This does not work
    list1.add(new Integer(0));
    Double d = list.get(0);// Hu-hoh you received an Integer, not a Double!!
    List<? extends Number> list2 = list; // This does work
    

    What you could do, is change

    myFn(String, List<Number>, List<Number>)
    

    to

    myFn(String, List<? extends Number>, List<? extends Number>)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a variable argument function which prints error messages in my application, whose
I have a module that has a function whose prototype is similar to that
I have a function whose input argument can either be an element or a
I have seen a function whose prototype is: int myfunc(void** ppt) This function is
function abc() { document.form1.1.disabled=true; } I have a select box whose id is 1
I have two functions whose underlying logic is the same but in one case
I have function getCartItems in cart.js and I want to call that function in
I have a function whose prototype is as follows: void foo(const char * data);
I have the following function whose last argument is a name of the text
I want to use the newton function loaded as from scipy.optimize import newton in

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.