Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #27540 > unrolled thread

problem using string array of list.

Started byNavneet Mathpal <navneetmathpal93@gmail.com>
First post2014-02-18 00:02 -0800
Last post2014-02-18 09:40 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  problem using string array of list. Navneet Mathpal <navneetmathpal93@gmail.com> - 2014-02-18 00:02 -0800
    Re: problem using string array of list. Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2014-02-18 09:40 +0000

#27540 — problem using string array of list.

FromNavneet Mathpal <navneetmathpal93@gmail.com>
Date2014-02-18 00:02 -0800
Subjectproblem using string array of list.
Message-ID<84e80bea-7033-4c67-99f8-d6af76b47326@googlegroups.com>
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?

[toc] | [next] | [standalone]


#27541

FromAndreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Date2014-02-18 09:40 +0000
Message-ID<slrnlg6al0.ngg.avl@gamma.logic.tuwien.ac.at>
In reply to#27540
Navneet Mathpal <navneetmathpal93@gmail.com> wrote:
> 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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web