I need to create an array of array with Strings in java...
For example, I read a file that contain for each column a sport and a player name..like:
The goal at the end it's for populate a list grouped in section (sports)
hockey,Wayne Gretsky
hockey,Mario Lemieux
baseball,Barry Bonds
baseball,A Rod
I need to create the [][] with this function :
public static String[][] getSportItems(int sectionCount){
String currentSection="";
int cnt=0;
try{
File file = new File(Environment.getExternalStorageDirectory()
+ "/sports.csv");
BufferedReader br = new BufferedReader(new FileReader(file));
String strLine = "";
while ((strLine = br.readLine()) != null) {
String[] data = strLine.split(";");
if(cnt>0){
}
cnt++;
}
}catch (IOException e) {
e.printStackTrace();
}
}
How I can manage that to create an array for each sport that contain the players associated with the sports.
I'm new in Java... Thanks
Listwhen the number of elements is unknown.