For example:
I have two type of objects:
public class Image {
...
}
And
public class Video {
...
}
I want to have a class that will contain a single list of those two objects, like this:
public class Media {
private List<Object> mediaList = new....
....
}
Create a parent class, and have Image and Video be children of it.
You can then make the list of the parent type.
Also, the following compiles, you would just have to cast the objects back when you retrieve them from the list.