Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error while passing List as a parameter

 
Arun R. S. Chandran
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Friends,

In my class I am using list to store some calculated result.

For this I am collecting data from DB and storing into a list object.
the declaration of the List is given below
____________________________________

List<GuageReportdata> values2 = new ArrayList<GuageReportdata>();
_________________________________


The List is declared in the type of another class GuageReportdata.
And I am using a methode-----
_________________________________

public List<GuageReportdata> addResultdataofLathe(ArrayList<GuageReportdata> values , int size ) {
......................
.........................
}


_______________________


But when I am calling the method and passing the list it's showing ERROR:
" Type mismatch: cannot convert from List<GuageReportdata> to ArrayList<GuageReportdata> "

I am calling the methode inthis way
----------------------------
List<GuageReportdata> result = addResultdataofLathe( values1, values1.size());
----------------------------


Please help me to find out where I made a mistake.

-ARUN
:roll:
 
Reinhard Horn
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Arun,

try to change the type of your input param from ArrayList to List.



Regards
 
Arun R. S. Chandran
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your kind advice, thank you very much.

I tried but that also throwing some error.


Actually the problem was with the return type of method.
Actually the method returns a value of type List.
But the receiving end "result" is declared as ArrayList.

Actually it was the problem.
But I didn't notice that.


-ARUN
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic