Improve method
This commit is contained in:
parent
ca1986f3dc
commit
63aa93ca11
1 changed files with 3 additions and 1 deletions
|
@ -308,12 +308,14 @@ public class MapMarkersDbHelper {
|
||||||
|
|
||||||
private void buildLinkedList(HashMap<String, MapMarker> markers, List<MapMarker> res) {
|
private void buildLinkedList(HashMap<String, MapMarker> markers, List<MapMarker> res) {
|
||||||
if (!markers.isEmpty()) {
|
if (!markers.isEmpty()) {
|
||||||
|
int count = 1;
|
||||||
for (MapMarker marker : markers.values()) {
|
for (MapMarker marker : markers.values()) {
|
||||||
if (!markers.keySet().contains(marker.nextKey)) {
|
if (!markers.keySet().contains(marker.nextKey) || count == markers.size()) {
|
||||||
res.add(0, marker);
|
res.add(0, marker);
|
||||||
markers.remove(marker.id);
|
markers.remove(marker.id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
buildLinkedList(markers, res);
|
buildLinkedList(markers, res);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue