hello everyone, I wrote this dummy tree class which is associated to itself, and i populate it using a recursive method. The recursive method, getMyChildren, is used to add child objects to parent object, and then grandchildren to children, and so on. In my method, after the recursion, I test the collection of children and they're always empty, even though they're not. Does anyone know why this happens? I would appreciate any thoughts.
I'm having an extremely hard time following the logic here, or why a method called "getMyChildren" would be the way to build a a tree in the first place. But in any case, there's only one place in the whole program where you call children.add():
So if there are already some children, add a new child. But of course, since we start out with no children, that's never going to change.