Element () { Element state = new Element("registry"); for (Map.Entry<String, String> entry : myUserProperties.entrySet()) { RegistryValue registryValue = get(entry.getKey()); if (registryValue.isChangedFromDefault()) { Element entryElement = new Element("entry"); entryElement.setAttribute("key", entry.getKey()); entryElement.setAttribute("value", entry.getValue()); state.addContent(entryElement); } } return state; }