public TreeItem<ITreeNode> toTreeItems() { final TreeItem<ITreeNode> result = new TreeItem<>(null); for (ITreeNode child : root.children()) { result.getChildren().add(createTreeItem(child)); } return result; }
private TreeItem<ITreeNode> createTreeItem(ITreeNode node) { final TreeItem<ITreeNode> result = new TreeItem<>(node); for (ITreeNode child : node.children()) { result.getChildren().add(createTreeItem(child)); } return result; }