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
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: 39547
    
  27
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 - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Read CSV in a map
 
Similar Threads
Question regarding Map interface
null values in hash map
Sorting values of a Map.
summing values with the same key
Check if Map contains an array as an entry value