void (Element element, Collection<? extends TreeItem<Pair<AbstractUrl, String>>> roots) { for (TreeItem<Pair<AbstractUrl, String>> root : roots) { final AbstractUrl url = root.getData().getFirst(); if (url == null) continue; final Element list = new Element(FAVORITES_ROOT); url.write(list); list.setAttribute(CLASS_NAME, root.getData().getSecond()); element.addContent(list); final List<TreeItem<Pair<AbstractUrl, String>>> children = root.getChildren(); if (children != null && !children.isEmpty()) { writeRoots(list, children); } } }