• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error while passing List as a parameter

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic