Information générale
Catégorie:
Programmation Orientée Object
Yes, but you'll have a list of Objects and just that. Even if your lists have always all their objects of some other types, the lists contain only Objects. So, your code will have to be full of casts, instanceof tests, etc.
A template is a little more. You can write a list class in a generic way and instanciate lists of any other types. So, the compiler can check a lot more things and you don't have to use casts or runtime type checks.
Although, the fact that all classes derive from Object is excelent in Java.
Vlad
>I'd use the Object type. Java has generic containter classes that don't rely on templates.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement