3 Replies Latest reply on Jul 17, 2009 11:21 AM by Nick Belaevski

    TreeNode<T> API doesn't allow for multiple types of nodes

    Paulo Pinto Novice

      Hi everyone,

      I have some code that makes use of TreeNodes with disregard for the Java 1.5 generics API.

      Now we are cleaning our code to be proper Java 1.5 and remove most of the build warnings we have related to raw types usage.

      Because of this, I just realized that the TreeNode API might not be properly thought out.

      On our current code we are able to mix different subclasses from TreeNode on the same tree, but if we use the proper generic arguments, then we need to use an external class (T) for all types of nodes. This is so, because given a type T, the complete set of nodes on the tree has to support the same type T and no longer multiple types of nodes.

      Am I speaking nonsense here and I just don't know how to properly use it, or hasn't anyone tried to use the TreeNodes like that?

      Regards,
      Paulo