Hi,
I have many objects which
can serve as parents. But actually, only very few of them do.
I have a child table with foreign keys to their parents, a common many-to-one relation.
In my program I want to print all a parent's children in one row, so I'd like to either have an array of all parent objects which actually
do have children, or a list of lists of children, where each children list contains all the children of one parent.
In code this would either be:
Code:
Parent[] parents; //only the parents that actually have children
or:
Code:
Vector<Vector<Child>> childrenPerParent; //outer vector contains one list per parent
or:
Code:
Child[][] children;
Any suggestions will be highly appreciated.
-Marvin