Define "fun". I could do it myself, but I'm too lazy. :-)
Seriously, this would be a recursive array of Objects, i.e would hold an objects (any type), but not primitives. Similar to TreeSet or Vector. Let's call it a "TreeArray", unless someone can think of a more appropriate name.
Each "parent" element would hold an Object containing the value of the parent, plus an array of TreeArray objects. (Thus the recursion.)
Methods would allow the caller to "walk" the TreeArray, and yes, this is very similar to what's available in DOM. However, I don't want it to be exclusively about DOM or Swing. I want it to be about simple old Object, same as, say, TreeSet or ArrayList in the 1.4 API.
In fact, I'm a little amazed this isn't in the 1.4 API. This kind of class has probably been reinvented a thousand times. If no one has one I can use, and none of you want to write it for fun,
profit and/or glory :-)...
...I guess I'll just have to "cowboy-up", write it myself, and post it for you all. Who knows? Maybe it'll even make it to the code barn. Yeehaw!
Respectfully,
Ben