I am getting value from treemap :
I had added to hashmap all coordinates in string format which was an rraylist now its string in treemap .So I would like to retrieve all the value from the String idlatlng which contains arraylist inside the string.:
Code added to hashmap
LatLng allLatLng= new LatLng((lat1),(long1));
all.add(allLatLng);
map.put("latlng" , all.toString());
the second treemap:
Collections.sort(list, new Comparator<Map<String, String>>() {
@Override
public int compare(Map<String, String> o1, Map<String, String> o2) {
String value1 = o1.get("amount");
String value2 = o2.get("amount");
return Integer.parseInt(value1)-Integer.parseInt(value2);
}
});
for (Map<String, String> map1 : list) {
String id = map1.get("id");
String amount = map1.get("amount");
System.out.println("amount= "+amount + " , " +"id = "+id);
String idlatlng = map1.get("latlng");
}
In the above code I am getting the value of latlng.
String idlatlng = map1.get("latlng");
idlatlng
contains arraylist of .So how do I convert the value from string above to arraylist.Its a follow up question from previous question.I really appreciate any help.Yhanks in Advance.
Output:
String idlatlng
---> arraylist<LatLng>
Unable to sort the the list by ascending order
The value I get from idlatlng is : [lat/lng: (70.0187, -141.0205), lat/lng: (70.4515,-144.8163), lat/lng: (70.4515,-144.8163), lat/lng: (70.4515,-144.8163), lat/lng: (70.4515,-144.8163), lat/lng: (70.4515,-144.8163), lat/lng: (70.4515,-144.8163), lat/lng: (70.4515,-144.8163), lat/lng: (70.4515,-144.8163)]