Reputation: 547
Is it possible to create generic class as following?
public class AnyClassTypeWithValue<Class<T>, E> {
}
I read code given in this java generics: accepting a class or interface link.
I dont think we can create class with type parameters class SomeClass<Class<T>, E>
I have seen class SomeClass<T, E>
but not something like above.
Upvotes: 0
Views: 135
Reputation: 1500815
It's not clear what you'd mean by that. Do you want something like:
public class AnyClassTypeWithValue<T extends Class<?>, E>
perhaps? You can't make Class<T>
itself the type parameter any more than you can declare a variable with a name List<String>
.
Upvotes: 4