> > 3. What's the rationale for having equals and hashCode > > be reference based? > > The alternative is to compare both the value and children of that node. But > in comparing the children, each child node will compare its value and > children and so on. This would be potentially very expensive. Its also how > JDOM does its equals method.
Just to clarify: JDOM uses identity-based equality, not semantic. Right? > > 4. Must tree iterators be depth-first? The ordered > > traversal for a heap tree isn't depth-first. > > No, but depth first is the one I needed ;-) There are two possibilities > here, > a) Add extra methods for different iteration types > b) Remove the comment that specifies how the iteration is done. I think, personally, for things like trees, either having depthFirstIterator() bredthFirstIterator() or removing all iteration from the tree directly, and require folks to do: Iterator iter = new DepthFirstIterator( tree ); or Iterator iter = new BredthFirstIterator( tree ); Just because there's no -default- way to iterate a tree, I don't think having just a plain iterator() method is sufficient. -bob -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>