2 import java
.io
.FileNotFoundException
;
3 import java
.util
.ArrayList
;
5 import java
.util
.Scanner
;
9 private String csvFile
= "data/countries.csv";
10 private ArrayList
<Country
> countryArrayListEurope
= new ArrayList
<>();
11 private ArrayList
<Country
> countryArrayListAfrica
= new ArrayList
<>();
12 private ArrayList
<Country
> countryArrayListAmericas
= new ArrayList
<>();
13 private ArrayList
<Country
> countryArrayListAsia
= new ArrayList
<>();
14 private ArrayList
<Country
> countryArrayListOceania
= new ArrayList
<>();
20 public void getCsvFile() {
21 CSVUtils csvUtils
= new CSVUtils();
22 Scanner scanner
= null;
24 scanner
= new Scanner(new File(csvFile
));
25 } catch (FileNotFoundException e
) {
28 while (scanner
.hasNext()) {
30 List
<String
> line
= csvUtils
.parseLine(scanner
.nextLine());
32 String c3
= line
.get(0);
33 String
[] splitArray
= c3
.split(",");
34 String c2
= line
.get(16);
35 String
[] splitArray2
= c2
.split(",");
37 if (line
.get(12).equals("Europe")) {
38 Country c
= new Country(splitArray
[1], line
.get(12), Double
.parseDouble(splitArray2
[0]), Double
.parseDouble(splitArray2
[1]));
39 countryArrayListEurope
.add(c
);
40 } else if (line
.get(12).equals("Africa")) {
41 Country c
= new Country(splitArray
[1], line
.get(12), Double
.parseDouble(splitArray2
[0]), Double
.parseDouble(splitArray2
[1]));
42 countryArrayListAfrica
.add(c
);
43 } else if (line
.get(12).equals("Americas")) {
44 Country c
= new Country(splitArray
[1], line
.get(12), Double
.parseDouble(splitArray2
[0]), Double
.parseDouble(splitArray2
[1]));
45 countryArrayListAmericas
.add(c
);
46 } else if (line
.get(12).equals("Asia")) {
47 Country c
= new Country(splitArray
[1], line
.get(12), Double
.parseDouble(splitArray2
[0]), Double
.parseDouble(splitArray2
[1]));
48 countryArrayListAsia
.add(c
);
49 } else if (line
.get(12).equals("Oceania")) {
50 Country c
= new Country(splitArray
[1], line
.get(12), Double
.parseDouble(splitArray2
[0]), Double
.parseDouble(splitArray2
[1]));
51 countryArrayListOceania
.add(c
);
57 /*Utils.displayArrayList(countryArrayListOceania);
58 Utils.displayArrayList(countryArrayListAfrica);
59 Utils.displayArrayList(countryArrayListAmericas);
60 Utils.displayArrayList(countryArrayListAsia);
61 Utils.displayArrayList(countryArrayListEurope);*/