From 75e93d6ec7529c4808592607ca2d144659efd2f4 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 23 Dec 2020 12:02:42 +0100 Subject: [PATCH] names update --- .../main/java/net/osmand/data/MapObject.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java b/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java index d3700896b2..5fb13d62ac 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java @@ -89,23 +89,22 @@ public abstract class MapObject implements Comparable { names.putAll(name); } } - + public Map getNamesMap(boolean includeEn) { - if (!includeEn || Algorithms.isEmpty(enName)) { - if (names == null) { - return Collections.emptyMap(); - } - return names; + if ((!includeEn || Algorithms.isEmpty(enName)) && names == null) { + return Collections.emptyMap(); } Map mp = new HashMap(); if (names != null) { - Iterator> it = mp.entrySet().iterator(); - while(it.hasNext()) { + Iterator> it = names.entrySet().iterator(); + while (it.hasNext()) { Entry e = it.next(); mp.put(e.getKey(), unzipContent(e.getValue())); } } - mp.put("en", unzipContent(enName)); + if (includeEn && !Algorithms.isEmpty(enName)) { + mp.put("en", unzipContent(enName)); + } return mp; } @@ -115,7 +114,7 @@ public abstract class MapObject implements Comparable { l.add(unzipContent(enName)); } if (names != null) { - for(String nm : names.values()) { + for (String nm : names.values()) { l.add(unzipContent(nm)); } }