I want to get name of each treeitem node and the parents for each, then put them in treemap, but when I run this sample code I get these result as values :
[TreeItem [ value: Function 12 ], TreeItem [ value: Function 13 ]]
[TreeItem [ value: Function 6 ]]
[TreeItem [ value: Function 15 ]]
[TreeItem [ value: Function 9 ], TreeItem [ value: Function 10 ]]
How can I get ride of extra things [TreeItem [ value: ] I just want the string like Function 12
ArrayList<String> kids = new ArrayList<>();
TreeMap<String, List<String>> parentChild = new TreeMap<>();
for (TreeTableColumn<String, ?> tt : treeTable.getColumns()) {
for (TreeItem node : root.getChildren()) {
if (!node.isLeaf()) {
parentChild.put(node.getValue().toString(),node.getChildren());
}
}
}
for(Entry<String, List<String>> ent : parentChild.entrySet())
System.out.println(ent.getValue());