random_destinations_car method implemented

distance_related_methods
Selim Eser 2024-06-09 18:38:38 +02:00
parent 5413a18435
commit 44b385bf3d
1 changed files with 19 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import java.net.http.HttpResponse.BodyHandlers;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.TreeSet;
import org.json.JSONObject;
@ -71,7 +72,24 @@ public class System {
}
public ArrayList<String> random_destinations_car(){
return new ArrayList<String>();
ArrayList<String> result = new ArrayList<>();
InputStream inputStream = Main.class.getResourceAsStream("/zip.csv");
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
String line;
while ((line = reader.readLine()) != null) {
line = line.replace("\"", "");
if(Double.parseDouble(distance(line.split(";")[0]).replace(" km", "")) > 150)
result.add(line);
}
} catch (Exception e) {}
return result;
}
public ArrayList<String> random_destinations_bike(){