I'm creating a complex data type. It's an ArrayList (chapters) of ArrayLists (chapter). However, there are two versions of the chapter, each with it's respected elements and data types.
How could I declare my complex data type so I could add one or another (to have, e.g., ArrayList(chapters) which contains (chapter_typeI,chapter_typeII,chapter_typeII,chapter_typeI,chapter_typeII, etc...)?
make an abstract class, from which the both type of chapters inherit, and then declare a list of this type.
The operations that you are going to call should be declared in the abstract class, and then overriden as necessary in the specific implementations.