File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Read CSV in a map Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Read CSV in a map" Watch "Read CSV in a map" New topic
Author

Read CSV in a map

Manzoor Elahi
Greenhorn

Joined: May 11, 2010
Posts: 11
Hi ,

I have a CSV file as below

VALUE 1A , VALUE 1B
VALUE 2A , VALUE 2B
VALUE 3A , VALUE 3B
etc

i need to store the values in a map as a key value pair, map<VALUE1A , VALUE1B>so on, so that i can process it further.

Can someone please help me how to do it. I end up inserting same values as both the key and value.

If someone can provide a code snippet it would be really helpful

TIA

Manzoor
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
Instead of implementing your own CSV parser (which isn't quite as trivial as it seems at first), I'd use one of the existing libraries; see AccessingFileFormats for links to some of them.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Read CSV in a map