Hello, I have a Tree that consists of TreeNodes, where TreeNode is
public class TreeNode {
private String label = null;
private String data = null;
private TreeNode parent = null;
private Vector <TreeNode> children = null;
}
I also have a HashMap <String, TreeNode> that keeps the label of a TreeNode (is unique for each node) and the reference to the spesific TreeNode of the Tree.
I want to delete a node of the Tree through its reference in HashMap. I tried this one:
Iterator iter = pHash.keySet().iterator();
while (iter.hasNext()) {
label = iter.next().toString();
// gets the value if there is any, else tNode is null
tNode = tHash.get(label);
if (tNode == null) {
pNode = null;
}
}
When I print the nodes of the Tree, i have all the nodes as before the operations. Any ideas please? Thank you in advance.