Lack of Generic Tree support
I am wondering how people feel about the lack of the Tree type in Java? I find the Java types pretty weak generally, but at least there are several Set, Map, List implementation to choose from. There is no Tree, or perhaps there are too many. There is the UI tree classes (in swing), the Preference class has a tree like interface, JNDI, etc.
I am wondering if this is a problem for others? We ended up creating our own Tree interface and implementations.
Pat O
[480 byte] By [
techneexa] at [2007-10-1 22:18:43]

What would your proposed Tree framework look like?Typically, trees are very specific and have specific algorithms.E.g. AVL tree, red-black tree, etc.Have you looked at the DefaultMutableTreeNode? If so, whatis lacking in your opinion?
> > Have you looked at the DefaultMutableTreeNode? If
> so, what is lacking in your opinion?
>
> It's Swing. I've used JVMs on headless Linux boxes
> which had serious issues with AWT to the extent that
> we simply did not use any AWT or Swing classes.
No, it isn't. I mean, sure, it's in a javax.swing.something package, but it doesn't have any GUI components. I don't think headlessness should affect it in the least.
I'm happy to be proven wrong, but only with malfunctioning code, not with a quick look at the name of the package.
> I don't think headlessness should affect it in the least.
I did wonder whether to pre-empt this reply. Looks like I made the wrong decision.
"Do not use anything in java.awt or javax.swing" was a company policy rather than a technical requirement. However, it had its roots in a technical requirement "Do not use anything which could classload java.awt.Component". DefaultMutableTreeNode is not caught by the technical requirement, but it is caught by the company policy.
I felt the reply was necessary because your company policy-makers aren't the only ones to reject DefaultMutableTreeNode "because it's Swing". I have seen that view expressed here before. So if you are not encumbered by policy, then DefaultMutableTreeNode is perfectly usable for tree structures.
> Of course there are tree data structures in Java:
> TreeSet, TreeMap. Do your homework.
A generic tree type and tree data-structures are not in the same category. Data-structures require specific nodes depending on the tree type. There would be no sense in using a generic tree node class in an AVL tree for example.