Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Convert LinkList to a Array

 
Aravind Prasad
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Ranchers,
I'm using JSP and MySQL for my project. In that I'm using a third-party graph tool which reads the chart data in String array and the chart value in double array.
I've all my database values stored in a linklist and i want to convert the link list to a double array and a String array

The code is given below



Where ex_cnt is the chart value which should be in double and ex_code is the chart data which should be in String.

Please help me ranchers to sort out this.

Thanks in advance

regards

Aravind Prasad
 
Robert Waals
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
convert your linkedlist to an array using
 
Aravind Prasad
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Robert,
Thanks for the reply. I've searched in google for some examples and i got one. With that one, i tried and got the error like this



and the error was


Please help me to solve this.

Thanks and regards
Aravind Prasad
 
Aravind Prasad
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've also tried this.. But getting the error like this



But the error i'm gettting is this



Please help me ranchers..
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You haven't told us what type of objects your LinkedList contains, nor precisely what you want to convert them to. I see you converting the list contents to a double[] and also to a String[] -- which is it? And what's actually in the LinkedList? Double? String? Something else?

Recall that Java is a "strongly typed" language, and conversions from one data type to another usually must be done explicitly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic