From 4ff9ce7486b51e00854508d4c6883a0f3f3413a0 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Mon, 11 Sep 2017 14:05:41 +0200 Subject: [android] - avoid adding duplicate points to bounds --- .../src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java index 8b2ccffef1..4fcb91033c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngBounds.java @@ -450,7 +450,7 @@ public class LatLngBounds implements Parcelable { */ public Builder includes(List latLngs) { for (LatLng point : latLngs) { - latLngList.add(point); + include(point); } return this; } @@ -462,7 +462,9 @@ public class LatLngBounds implements Parcelable { * @return this */ public Builder include(@NonNull LatLng latLng) { - latLngList.add(latLng); + if (!latLngList.contains(latLng)) { + latLngList.add(latLng); + } return this; } } -- cgit v1.2.1