Here I have the desired format that I want my locations to appear as.
private HashMap<String, Location> loadLocationData()
{
HashMap<String, Location> locations = new HashMap<String, Location>();
locations.put("Paris", new Location("Paris",48.8566,2.3522,TimeZone.getTimeZone("France/Paris")));
locations.put("Rome", new Location("Rome",41.9028,12.4964,TimeZone.getTimeZone("Italy/Rome")));
return locations;
}
Here is the text file which I want to read from, with the lines of data in this format:
Paris,48.8566,2.3522,France/Paris
Rome,41.9028,12.4964,Italy/Rome
Basically, I need to be able to read the text file, and then somehow insert that text into the format I have in the first block of code I posted.
If someone could help me with the best way to do this I will be very thankful. Also note, when I'm adding a new location to the list, the name of the city needs to be repeated, as it is a key-value set.