H
Henry Townsend
Is there a standard Java tree structure which allows the programmer to
attach nodes to parent nodes? Basically I need to represent something
like a family tree (actually it's a process tree but the logic is the
same). For each new node I will know, or have a way of determining,
which pre-existing node is its parent and just need to attach it there,
and subsequently have a means of traversing it.
Everything tree-related I can find in java.* is either a GUI/display
class(like JTree) or has a "natural ordering" like java.util.TreeSet
which does not allow the user to pick the parent.
Of course I could implement something myself by making each object hold
a reference to its parent and a list of references to its children etc,
but would prefer to use something built-in, documented, and stable. Does
a class like this exist?
Thanks,
HT
attach nodes to parent nodes? Basically I need to represent something
like a family tree (actually it's a process tree but the logic is the
same). For each new node I will know, or have a way of determining,
which pre-existing node is its parent and just need to attach it there,
and subsequently have a means of traversing it.
Everything tree-related I can find in java.* is either a GUI/display
class(like JTree) or has a "natural ordering" like java.util.TreeSet
which does not allow the user to pick the parent.
Of course I could implement something myself by making each object hold
a reference to its parent and a list of references to its children etc,
but would prefer to use something built-in, documented, and stable. Does
a class like this exist?
Thanks,
HT