G
Gunnar Wagenknecht
Hi!
I have the following method which I want to optimize. I'm experimenting
with generics and the question I have is, can I avoid the additional
parameter Class<T>?
private <T extends ImportableObject> void
mergeImportWithDatabase(Database database, Map<String, T>
importedObject, Class<T> objectType) {
...
database.getAllObject(objectType)
...
}
I tried to replace "objectType" with "T.class" but that gave me a
compiler error ("illegal class literal"). That's why I added the
argument "Class<T> objectType".
Thanks,
Gunnar
I have the following method which I want to optimize. I'm experimenting
with generics and the question I have is, can I avoid the additional
parameter Class<T>?
private <T extends ImportableObject> void
mergeImportWithDatabase(Database database, Map<String, T>
importedObject, Class<T> objectType) {
...
database.getAllObject(objectType)
...
}
I tried to replace "objectType" with "T.class" but that gave me a
compiler error ("illegal class literal"). That's why I added the
argument "Class<T> objectType".
Thanks,
Gunnar