G
Gustaf Liljegren
My input data consists of a list of parent-child relationships. One
item in this list can be modelled like this:
+---------+
| Item |
+---------+
| Parent |
| Child |
+---------+
The Parent and Child properties are unique strings. One item's child
may be another item's parent and so on, so all together the list of
Item objects can be transformed into a hiearchy of Item objects. The
question is HOW.
I imagine a collection class called Item, with the List containing
other Item objects (since one parent can have many children).
I didn't start coding yet, becuase I have no idea how to approach the
problem. Hope someone can help me outlining the procedure.
Gus
item in this list can be modelled like this:
+---------+
| Item |
+---------+
| Parent |
| Child |
+---------+
The Parent and Child properties are unique strings. One item's child
may be another item's parent and so on, so all together the list of
Item objects can be transformed into a hiearchy of Item objects. The
question is HOW.
I imagine a collection class called Item, with the List containing
other Item objects (since one parent can have many children).
I didn't start coding yet, becuase I have no idea how to approach the
problem. Hope someone can help me outlining the procedure.
Gus