1

I want to take Latlong values stored in Hash map as key value pairs.

List<List<HashMap<String, String>>> routes

'routes' hold the values. I want to get those values

structure

5
  • routes.get(x).get(y).get(z)... Commented Jan 1, 2017 at 18:43
  • You can get a value with somethings like routes.get(0).get(0).get("yourKey") but can you be more precise about the structure of this combination of collections ? Commented Jan 1, 2017 at 18:49
  • [link] (postimg.org/image/qtngmsd9p) @Y. Tarion kindly have a look at image for structure... Thank You Commented Jan 1, 2017 at 18:59
  • Oh ok, so if you do routes.get(0).get(0) you get a HashMap<String,String> that I'll call "latlong". latlong.get("lat") will return the latitude and latlong.get("lng") the longitude Commented Jan 1, 2017 at 19:21
  • 1
    Yeah thnx Tarion for solution... Commented Jan 1, 2017 at 19:48

1 Answer 1

3

If you break it down into the parts so you understand it:

List<HashMap<String, String>> route = routes.get(0);
HashMap<String, String> position = route.get(0);
String latitude = position.get("lat");
String longitude = position.get("lng");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.