I need to instantiate generic variable like Class>.
For example,
Class<? extends List<String>> = ...
Variant 1:
Class<? extends List<String>> clazz = LinkedList.class;
don’t work – “Incompatible types”.
Variant 2:
Class<? extends List> clazz = LinkedList.class;
work, but in this case List is a raw type – not good.
How to instantiate such variables?
1 Answer