I need to figure out how to get the following data into two ArrayLists or arrays...
THIS THAT OTHER
1 2 3
4 5 6
7 8 9
I need the column titles to go into one array or ArrayList, and the integer values to go into a two dimensional array or ArrayList.
Here is my attempt at the Strings:
cities = new ArrayList<String>();
String newCities;
newCities = (inFile.nextLine());
String[] stringArray = newCities.split(" ");
for (int i = 0; i < stringArray.length; i++){
cities.add(stringArray[i]);
}
System.out.println(cities);
I can't figure out how to do the integer values.
Finally, this is for the implementation of a Traveling Salesman Problem so if you can think of a better way to handle this data, let me know! Thanks for your time!