mardi 18 juillet 2017

how to enforce that Collection that contain only objects that implement a interface , but are from the same implementing class?

assuming there is an interface called Entity, there are many classes that implement it. I need to create a class that for each instance of the class, its collection will contain only objects that implement the interface Entity, but are from the same implementing class, for example - if Person and Bicycle implement the interface Entity, then an instance of the class will have a collection full only with Person objects or Bicycle objects but not both. I appreciate your help!

Aucun commentaire:

Enregistrer un commentaire