I have a Region Hierarchy(think State, District, Taluk, etc) that I need to represent using a Tree. I saw a few implementations of a Tree in the public domain BUT not sure how good they are and how well they are maintained. Apache Collections doesn't have one of those NOR do the google collections. I'm wondering if any of you can point me to an implementation of a Tree in Java(with generics).
Thank you,
Update I am looking for a Tree Datastructure, preferably implemented using Generics : well tested.
Check out DefaultMutableTreeNode. It's not generic, but otherwise seems to fit the bill. Even though it's in the javax.swing package, it doesn't depend on any AWT or Swing classes. In fact, the source code actually has the comment // ISSUE: this class depends on nothing in AWT -- move to java.util?
Implementing a tree using generics is pretty simple, why not give it a try yourself? If you're not comfortable with generics, you can try declaring a tree that contains elements that implement an interface, then just have all your various region elements implement that interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With