void (Element root, Map<String, String> map, @NonNls @Nullable String rootName, @NonNls String entryName) { Element mapRoot; if (StringUtil.isNotEmpty(rootName)) { mapRoot = new Element(rootName); root.addContent(mapRoot); } else { mapRoot = root; } final String[] names = ArrayUtilRt.toStringArray(map.keySet()); Arrays.sort(names); for (String name : names) { final @NonNls Element element = new Element(entryName); element.setAttribute("name", name); final String value = map.get(name); if (value != null) { element.setAttribute("value", value); } mapRoot.addContent(element); } }