From 24c7b683b0d475c605ffbb4ce81fdb9e28e21231 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 23 Aug 2017 16:28:18 +0200 Subject: [PATCH] Improve --- .../src/net/osmand/binary/BinaryMapDataObject.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java index fda5b39956..d070cdbfd2 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java @@ -11,6 +11,7 @@ import java.util.TreeSet; import net.osmand.binary.BinaryMapIndexReader.MapIndex; import net.osmand.binary.BinaryMapIndexReader.TagValuePair; import net.osmand.render.RenderingRulesStorage; +import net.osmand.util.Algorithms; public class BinaryMapDataObject { protected int[] coordinates = null; @@ -249,13 +250,11 @@ public class BinaryMapDataObject { } else if(objectNames.size() != thatObj.objectNames.size()){ equals = false; } else { - Object[] thisNames = objectNames.values(); - Object[] thatNames = thatObj.objectNames.values(); - String[] thisStrings = Arrays.copyOf(thisNames, thisNames.length, String[].class); - String[] thatStrings = Arrays.copyOf(thatNames, thatNames.length, String[].class); - TreeSet st = new TreeSet(Arrays.asList(thisStrings)); - TreeSet ot = new TreeSet(Arrays.asList(thatStrings)); - equals = st.equals(ot); + for(int i = 0; i < namesOrder.size() && equals; i++) { + String o = objectNames.get(namesOrder.get(i)); + String s = thatObj.objectNames.get(thatObj.namesOrder.get(i)); + equals = Algorithms.objectEquals(o, s); + } } }