I've always wondered what is the best practice to create objects which have lists within lists within lists etc. Let's say I have this sort of object :
    root = new CarrierTreeNode(null, 
            new CarrierTreeNode[] {
                new CarrierTreeNode(new CarrierTreeItem("item1"), new CarrierTreeNode[] {
                    new CarrierTreeNode(new CarrierTreeItem("item1.1"))
                }),
                new CarrierTreeNode(new CarrierTreeItem("item2"), new CarrierTreeNode[] {
                    new CarrierTreeNode(new CarrierTreeItem("item2.1"))
            })
    });
and I want to generate this dynamically and also access and modify the lists/arrays within it dynamically. Is there a design pattern for this? Thank you.
To make it more clear, the constructor used here is like this : node (item, node[])
 
     
     
    