Consider I have an object O which is linked to an array of several object O's that can be retrieved by doing O.getAllObjects();

For a given object O, I want to see from the top down all links from a given object I.E

O1 > O2 > O3 > O4
O1 > O2 > O3 > O8
O1 > O5 > O2

In a sort of tree like structure, so each branch of the tree basically needs to be explored all the way down to the end before coming back to the beginning and following the next path. I'm doing this using iteration where I return all objects, get the first one, move into it and get it's first one etc. The problem is when I come back up there is no indication to the system about the fact that one 'leaf' (object) on a branch has been read. Because for the branch all objects are retrieved from a class which holds the objects' details and returns all of them using O.getAllObjects();

I hope my explanations aren't too unclear.

Thanks for the help everyone.