I have a collection where each node is either Class A or a collection of Class A.
This is also recursive in that each node in the collection of Class A could be Class A or a collection of Class A.
I am currently just using List and then checking the Object to see if it is Class A or a List of Class A but that seems to defeat the purpose of using generics. I think I need a more tree like structure. Thoughts?
Consider creating a class (
Wrapper<ClassA>) that can hold either an instance ofClassAor aList. Then make yourListsand innerListsbeList<Wrapper<ClassA>>