private Stack<Stop> fetchStopSequence(String key) throws IOException { if (stopSequences.containsKey(key)) { return stopSequences.get(key); } Stack<Stop> stopSequence = new Stack<Stop>(); url = DBC.URL + '/' + DBC.GOOGLE_MAPS_EXTENSION + DBC.STOP_SEQUENCE_EXTENSION + routeShortName() + "&direction=" + direction.toChar(); Document doc = makeTmpJSoupDoc(url); Elements data = doc.getElementsByTag("data"); if (!data.isEmpty()) { Elements pois = data.get(0).getElementsByTag("poi"); for (Element poi : pois) { String address = poi.getElementsByTag("address").get(0).html() + ", " + poi.getElementsByTag("location").get(0).html(); double lat = Double.parseDouble(poi.getElementsByTag("lat").get(0).html()); double lon = Double.parseDouble(poi.getElementsByTag("lng").get(0).html()); int code = Integer.parseInt(poi.getElementsByTag("stopnumber").get(0).html()); Stop stop = new Stop(code, lat, lon, address, agency); if (!StopSiteCrawler.stopsFile.get("stop_code").contains(code)) { stop.write(); } stopSequence.push(stop); } } stopSequences.put(key, stopSequence); return stopSequence; }