I have several classes that are used to create objects. These objects each have code that must be run that depends on the order of insertion.
They need to be stored in order - and recalled in the order they were stored.
- Object A
- Object B
- Object A
- Object A
- Object C
- Object D
I'm not sure if the proper way of handling this in Java is a generic list and checking typing at runtime.
List<Object> list = new ArrayList<Object>();
I've also thought about storing each object type in their own typed list with a parent object reading from the lists in the proper order. However, this seems more complex than just dealing with checking object types at runtime.
What is the proper "Java" way to handle this?
Aucun commentaire:
Enregistrer un commentaire