java - Need help casting from a List<String[]> to an Array -


i using csvparser library univocity , having trouble converting list object in array read from.

the method keeps throwing arraystoreexception is:

list<string[]> resolveddata; string[] array = new string[7000];  public void parseurls() throws filenotfoundexception {      csvparsersettings settings = new csvparsersettings();     settings.getformat().setlineseparator("\n");     csvparser parser = new csvparser(settings);      try {         resolveddata = parser.parseall(new filereader("c:\\users\\kevin.anderson\\desktop\\book1.csv"));         resolveddata.toarray(array);     } catch (exception ex) {         system.out.println(ex.tostring());      } } 

is there way items out of list array or there easy way iterate thru items in list string array?

thank

try this.

    list<string[]> resolveddata;     string[][] array;      public void parseurls() throws filenotfoundexception {          csvparsersettings settings = new csvparsersettings();         settings.getformat().setlineseparator("\n");         csvparser parser = new csvparser(settings);          try {             resolveddata = parser.parseall(new filereader("c:\\users\\kevin.anderson\\desktop\\book1.csv"));             array = new string[resolveddata.size()][];             resolveddata.toarray(array);         } catch (exception ex) {             system.out.println(ex.tostring());         }     } 

basic errors assumed fixed size of incoming list of 7000 , single dimension array addressed with

string[][] array = new string[resolveddata.size()][];


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -