I get a NoSuchElementException, now debugging this I noticed that the Car and Carmap are created properly and the values stored appropriately so I'm not sure exactly which next token the ST isn't seeing? Or whether it's stopping when is sees that there are no more tokens.
Thanks to any and all for input.
Carmap = new HashMap<String,Car>();
//Change file path accordingly
File f = new File("C:\\XXX\\XXX\\XXX\\CarFaxDB.txt");
//Check to see if file exists, else create file
if (f.exists()){
String data[] = readFile(f);
for (int i =0; i<data.length; i++){
if (data[i] != null){
if (i>0){
String line = data[i];
StringTokenizer st = new StringTokenizer(line,",");
String VIN = st.nextToken();
String carMake = st.nextToken();
String carModel = st.nextToken();
int carYear = Integer.parseInt(st.nextToken());
data[i]= line;
Car car = new Car(VIN, carMake, carModel, carYear);
Carmap.put(car.getVIN(), car);
}
}
}
}