title: How can i pinpoint a circular object reference in a large collection of objects?
body: <p>I am retrieving, and copying a quite large collection of folder objects from an external source. They all have a folder id, and a parent folder id, but does not come as a tree structure. after retrieving them, I organize them in tree node objects, with a top root. However, one or more of the folders creates a circular reference, and I am having trouble figuring out how to pinpoint where.</p>
  
  <p>Java does not throw any errors when creating the circular reference. The error comes as a stackoverflow error, when I try to encode it to json format, before sending it to the client side of a web application. Because the error is first visible to me then, I can't see which object is the cause of the error at all.</p>
  
  <p>In this particular problem, I am at a loss of a strategy. Are there any standardized, or good ways of recognizing circular object references, like the one in my case?</p>