void (Element to) { synchronized (myConflicts) { myConflicts.forEach((path, conflict) -> { if (conflict.ignored) { Element fileElement = new Element("file"); fileElement.setAttribute("path", path); fileElement.setAttribute("ignored", Boolean.toString(conflict.ignored)); to.addContent(fileElement); } }); } XmlSerializer.serializeInto(myOptions, to); }