+ private void initCountryFromCSV(String name) {
+ Scanner scanner = null;
+ try {
+ scanner = new Scanner(new File(csvFile));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ boolean found = false;
+ while (scanner.hasNext()) {
+ List<String> line = CSVUtils.parseLine(scanner.nextLine());
+ String countryList = line.get(0);
+ String[] countryArray = countryList.split(",");
+ String latLng = line.get(16);
+ String[] latLngArray = latLng.split(",");
+ if (countryArray[0].equals(name)) {
+ found = true;
+ setRegion(line.get(12));
+ setLat(Double.parseDouble(latLngArray[0]));
+ setLng(Double.parseDouble(latLngArray[1]));
+ setFlag(line.get(21));
+ break;
+ }
+ }
+ if (!found)
+ System.out.println("Country " + name + " not found");
+ scanner.close();
+ }
+