• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How collection.toArray() works?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
In my workspace i am facing a problem.
In my java code i have a collection which contains the data like

Account No, Account Type, Currency, Transaction Date, Transaction Id, Channel Description, Description, Debit Amount, Credit Amount

.
I want this data to be exported to CSV format.So i created a out stream.I changed the collection to array.Now i want to iterate the array and create a CSV file in the above mentioned format.I don't know how to do that.

Kindly help me in this issue.

Thanks
Mohan
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you want to show us what you have so far?
(not your entire application, mind you, just the important bits)
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mohan,

Are you storing the data inside an Object and then add that object in the Collection or adding the data in comma seperated format as a String ?. Please clarify me.

Regards,
Loga
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohan,

It's not clear to me which part of this task you're stuck on.

If you're unfamiliar with working with arrays in Java, part 9 of Bradly Kjell's "Introduction to Computer Science using Java" includes good lessons and practice exercises to help learn the subject.

If you're not yet comfortable writing data to a text file, chapters 82, 83 and 87 in part 13 of Kjell's lessons cover the subject well.
 
mohan kumar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks guys...and Mr.Dirk Schreckmann link helped me a lot...
 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic