• 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Map to CSV

 
Greenhorn
Posts: 25
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Hashmap that I'd like to print to the response in this format:


I've tried something like this, but it won't quite print it in the format I need.


Kindly help! I've looked at OpenCSV and others, but can't figure out a way
 
Raja Avrv
Greenhorn
Posts: 25
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I found something that might work, but I don't know how to print key and value in the format I described earlier:

 
Sheriff
Posts: 3122
459
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you are doing now is getting the entry values from the map and transforming those values to a string with all the values on a single line, separating the values with a pipe character:

What you probably want to do is instead get Entrys from the map, transform those in to how you want them to be represented (key | value), and then collect all those in to a string, separating each one with the appropriate line-separator character/sequence:
 
Happily living in the valley of the dried frogs with a few tiny ads.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic