problem using string array of list.

N

Navneet Mathpal

hi,

i was trying to use follwing code:-

int siz= csvReader.readAll().size();


for(int i=1;i<= siz;i++)
{
row = csvReader.readNext();


collection.insert(new BasicDBObject("_id",i).append("search term",row[0]).append("search id",row[1]).append("result",row[2]));
}

i am trying to run code <=siz but it is showing an exception and data is not getting insert .
but in case i am using integer value instead of siz it running fine.

any suggestion?
 
A

Andreas Leitgeb

Navneet Mathpal said:
i was trying to use follwing code:-
int siz= csvReader.readAll().size();
for(int i=1;i<= siz;i++) {
row = csvReader.readNext();

I don't know what class you're using, but it seems odd, that
you "readAll()" first, and then want to readNext() some more.

You might not want to waste the result from readAll() for
merely getting the size, when all the precious data is
probably read in and stored there, already.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top