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?
You cannot cast
List<Double>to aList<Number>because the following code would break yourList<Double>What you could do, is change
to