Guus was kind enough to make a maven project for the Generic Tree. He also fixed an error in my equals method for the GenericTreeNode (I intended to do Object.equals(Object obj) but was doing GenericTreeNode.equals(GenericTreeNode obj). Since it's a maven project, you can easily create a jar out of it and add it as a dependency to your project. You can download the project here. Thanks Guus!
7 thoughts on “Maven project for Generic (n-ary) Tree in Java”
I just downloaded the files. Can you help me understand how the classes GenericTreeNode and GenericTree tie tigether? If I just want to build a tree of objects of type T, would I need the GenericTree class?
Take a look here here; I’ve got an example that uses both classes. The GenericTreeNode class represents each node in the tree whereas the GenericTree class provides you operations that work on the tree of nodes. You can build a tree of objects using just nodes, but you won’t be able to operate on the tree unless you use the GenericTree class.
I tried building with the new version of maven (3) but get lots of errors. I was able to build with the old version of maven.
Might I suggest that a jar is included, or, better yet, that a project (like google code) is used with a pre-built jar available in the downloads?
I can set it up if you would like.
I look forward to trying out your library!
Maven can I somehow put this tree in JtreePannel to display it properly