I am reading in a .csv
file sort of like a spreadsheet in excel. There are a certain number of columns, determined by the file, and I read each line into a string array using the .split(",")
method. I then put this into an array list so it can hold all of the string arrays without giving it a specific size. However, when I go to sort the array list using Collections.sort()
, the program breaks. What could the problem be? Here is my code to sort:
Collections.sort(stringList, new Comparator < String[] > () {
public int compare(String[] strings, String[] otherStrings) {
return -1 * (strings[sortNum].compareTo(otherStrings[sortNum]));
}
});
sortNum
come from? – dario_ramos Sep 6 '11 at 16:05sortNum
+1 cells? – Peter Lawrey Sep 6 '11 at 16:06sortNum
? – guardianpt Sep 6 '11 at 16:07sortNum
is not out of the bounds of eitherString[]
? – nicholas.hauschild Sep 6 '11 at 16:07