names update

This commit is contained in:
Victor Shcherb 2020-12-23 12:02:42 +01:00
parent d8ed8388cf
commit 75e93d6ec7

View file

@ -89,23 +89,22 @@ public abstract class MapObject implements Comparable<MapObject> {
names.putAll(name); names.putAll(name);
} }
} }
public Map<String, String> getNamesMap(boolean includeEn) { public Map<String, String> getNamesMap(boolean includeEn) {
if (!includeEn || Algorithms.isEmpty(enName)) { if ((!includeEn || Algorithms.isEmpty(enName)) && names == null) {
if (names == null) { return Collections.emptyMap();
return Collections.emptyMap();
}
return names;
} }
Map<String, String> mp = new HashMap<String, String>(); Map<String, String> mp = new HashMap<String, String>();
if (names != null) { if (names != null) {
Iterator<Entry<String, String>> it = mp.entrySet().iterator(); Iterator<Entry<String, String>> it = names.entrySet().iterator();
while(it.hasNext()) { while (it.hasNext()) {
Entry<String, String> e = it.next(); Entry<String, String> e = it.next();
mp.put(e.getKey(), unzipContent(e.getValue())); mp.put(e.getKey(), unzipContent(e.getValue()));
} }
} }
mp.put("en", unzipContent(enName)); if (includeEn && !Algorithms.isEmpty(enName)) {
mp.put("en", unzipContent(enName));
}
return mp; return mp;
} }
@ -115,7 +114,7 @@ public abstract class MapObject implements Comparable<MapObject> {
l.add(unzipContent(enName)); l.add(unzipContent(enName));
} }
if (names != null) { if (names != null) {
for(String nm : names.values()) { for (String nm : names.values()) {
l.add(unzipContent(nm)); l.add(unzipContent(nm));
} }
} }