harryanand060 / android-maps-extensions

Automatically exported from code.google.com/p/android-maps-extensions
0 stars 0 forks source link

getMarkers() getting different results #44

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I am working on a map with a bunch of markers. In some parts of the code I call 
myMap.getMarkers() to obtain a List of them. I happen to find a different order 
within this list in every call. 
I expected the list to be in the same order as when the markers were initially 
added to the map.
Which is the logic followed by this method?
Thanks and regards

Original issue reported on code.google.com by pablol.s...@gmail.com on 16 May 2014 at 7:03

GoogleCodeExporter commented 8 years ago
Markers and other visual objects are kept in HashMap. If you change that to 
LinkedHashMap, you will get the order. Just a small memory penalty, no 
performance loss AFAIK.

This is the line to change for markers:

https://github.com/mg6maciej/android-maps-extensions/blob/develop/android-maps-e
xtensions/src/com/androidmapsextensions/impl/MarkerManager.java#L51

Original comment by maciek.g...@gmail.com on 16 May 2014 at 7:19