Mar 022010

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!

  4 Responses to “Maven project for Generic (n-ary) Tree in Java”

  1. Hi Vivin,

    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?

  2. @mayank
    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.

  3. Hi,

    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!



  4. Maven can I somehow put this tree in JtreePannel to display it properly

Leave a Reply

All original content on these pages is fingerprinted and certified by Digiprove