implementing sorting and searching for .csv file

hi,i have a .csv file which i would like to search based on certain columns at runtime ?what is a good way to do it ?1. Not sure to use Array or Map ?2. how do i implement multiple string keys searches ?thanks for any feedback :)
[271 byte] By [tt_linuxa] at [2007-11-27 0:25:41]
# 1

> hi,

>

> i have a .csv file which i would like to search based

> on certain columns at runtime ?

> what is a good way to do it ?

read the file using File I/O

compare the data you read to your search criteria

> 1. Not sure to use Array or Map ?

depends, array will store a bunch of stuff and a Map will store that stuff in key/value pairs for easy lookup

> 2. how do i implement multiple string keys searches

i use java

SoulTech2012a at 2007-7-11 22:23:37 > top of Java-index,Core,Core APIs...
# 2

What about this solution? For parsing .csv files you can use http://ostermiller.org/utils/CSV.html. The result of the parsing is a 2 dim array. From the example:

String[][] values = CSVParser.parse(

new StringReader(

"hello,world\n" +

"how,are,you"

)

);

Now you can search through the array by hand or use another open source software: http://jakarta.apache.org/commons/jxpath/. With JXPath you can use XPath queries on arbitrary sources (xml files, beans, maps). But I think this is a little bit weird for this example :-)

Christian Ullenboom | tutego

Christian.Ullenbooma at 2007-7-11 22:23:37 > top of Java-index,Core,Core APIs...
# 3
hi guys,thank you for your response. i have already implemented using treemap and ostermiller CSV utility.
tt_linuxa at 2007-7-11 22:23:37 > top of Java-index,Core,Core APIs...