So let's say I'm building a Tree using javax.swing.tree.DefaultMutableTreeNode and I add N children to a particular node. I want the children to be in a particular order (based on Comparable/a custom Comparator) like a search tree, even if I insert them out of order, like this:
node.insert(child2);
node.insert(child3);
node.insert(child1);
But DefaultMutableTreeNode doesn't do any kind of sorting like that. For my particular case, I even know the desired index of the child node in the parent's array, but I tried DefaultMutableTreeNode.insert and got a lot of ArrayIndexOutOfBoundsExceptions.
Can anyone recommend a library that does what I need? Or will I have to write a search tree like that myself?