You can do this with the butt.
Class<Map<String, String>> clazz = (Class<Map<String, String>>) (Object) Map.class;
This generates a warning, but compiles.
The problem is that due to the erasure of the type, the resulting object at run time is no different from Map.class (it does not know about the type).
If you need an object that really represents Map<String, String> , you can examine java.lang.reflect.Type or Guava TypeToken .
Paul boddington
source share